Compare commits

...

3228 Commits
v0.0.6 ... v0.4

Author SHA1 Message Date
Trent Mick
1f4e0c02b5 build: fix gcc 4.7 sunos build
gcc 4.7 doesn't understand -threads, use -pthreads instead.

Fixes #4211.
2012-10-30 22:48:38 +01:00
Ben Noordhuis
7fd1c08b16 bench: backport http_simple benchmark from master 2011-10-29 07:23:01 +02:00
isaacs
ff942c6b39 Fix #1851 Correct X/index doc 2011-10-10 11:47:10 -07:00
Brian White
eb40dcb097 Fix typo for fs.write docs
Fixes #1843.
2011-10-09 16:51:42 +09:00
Ryan Dahl
007ddcd2cd Move test-net-write-callbacks to pummel
Runs in 3 seconds.
2011-09-30 10:31:39 -07:00
koichik
4cdf9d4158 tls: Improve TLS flow control
Fixes #1775.
2011-09-30 15:44:45 +09:00
koichik
49ac083dc1 tls: Add test for #1775 2011-09-30 15:44:13 +09:00
Marco Rogers
3fc01d9770 docs: note about empty environment in child processes
Fixes #1794.
2011-09-29 19:50:25 +09:00
Ryan Dahl
dea49e3d19 net: Fix string-concat hot path bug
Also removes functionality added in f9fec3a2d6
because it changes API. (That patch shouldn't have been added anyway.)
2011-09-28 17:49:33 -07:00
Ben Noordhuis
942b92a06e cygwin: fix new[]/delete mismatch 2011-09-25 03:59:50 +02:00
Ben Noordhuis
aff91f79ae cygwin: fix return of uninitialized variable 2011-09-25 03:59:50 +02:00
Eric Lovett
f9fec3a2d6 net: callback to socket.write should always be called asynchronously 2011-09-25 00:23:27 +02:00
Ben Noordhuis
f6bce20e5e buffers: handle bad length argument in constructor
Coerce fractional, negative and non-numeric length arguments to numbers.
Fractional numbers are rounded up, negative numbers and non-numeric values
are set to zero.
2011-09-24 18:31:56 +02:00
Ben Noordhuis
93aad55342 crypto: fix delete of potentially uninitialized pointer 2011-09-22 06:16:53 +02:00
Ben Noordhuis
fdb0eb5825 crypto: fix read of potentially uninitialized variable 2011-09-22 06:16:47 +02:00
Ben Noordhuis
3a9b08f156 crypto: look up SSL errors with ERR_print_errors() 2011-09-22 06:16:42 +02:00
Ben Noordhuis
9ef962f9ee crypto: fix error message buffer overrun
ERR_error_string() expects a buffer of at least 256 bytes, the input buffer
was not even half that size. Use ERR_error_string_n() instead.
2011-09-22 06:16:34 +02:00
Vitor Balocco
97d355c273 docs: Add anchor links next to each function
Modify doctool.js to automatically create anchor links for
every function, for easy linking.
Include support for functions that have a <h4> level

Fixes: #1718.
2011-09-21 21:08:53 +09:00
koichik
b93a7cc99e docs: add links 2011-09-20 15:50:36 +09:00
Ben Noordhuis
ed44098cf6 build: fix SYS_clock_gettime feature check
execute=True makes it fail while cross-compiling.

Fixes #1541.
2011-09-16 17:55:54 +02:00
Ryan Dahl
b31d5ac639 Update website address in Makefile 2011-09-15 17:49:29 -07:00
Ryan Dahl
cfe0f4226b Now working on v0.4.13 2011-09-15 17:31:35 -07:00
Ryan Dahl
771ba34ca7 Bump version to v0.4.12 2011-09-15 16:46:39 -07:00
Ryan Dahl
6312e889b1 Drain OpenSSL error queue? Addresses #1719 2011-09-15 15:04:09 -07:00
isaacs
e06ce7562c Fix #1707 hasOwnProperty usage
If hasOwnProperty is overridden, then calling `obj.hasOwnProperty(prop)`
can fail.  Any time a dictionary of user-generated items is built, we
cannot rely on hasOwnProperty being safe, so must call it from the
Object.prototype explicitly.
2011-09-15 10:54:08 -07:00
isaacs
b3af074a02 Add querystring test for hasOwnProperty usage 2011-09-15 09:52:49 -07:00
isaacs
98990b9779 Fix #1707 hasOwnProperty usage 2011-09-15 09:46:30 -07:00
Ben Noordhuis
5724b54d2e test: add http multi-line header test
Test case for #1569. Verify that http_parser parses multi-line headers.
2011-09-14 16:29:32 +02:00
Ben Noordhuis
8b2a3354f9 http_parser: cherry-pick 3258e4a and b89f944 from upstream
Fixes #1569, parse error on multi-line HTTP headers.
2011-09-14 16:07:37 +02:00
koichik
fdbfc9ceb7 net: Socket write encoding case sensitivity
Fixes #1586.
2011-09-04 13:53:38 +09:00
koichik
3e853e627e buffer: write() should always set _charsWritten.
Refs #1633.
2011-09-03 11:48:27 +09:00
koichik
96ede8cc9b buffer: Avoid overrun with 'binary' encoding.
Fixes #1624.
2011-09-02 09:56:58 +09:00
isaacs
ef27d56cc1 Fixes #1610 Remove DigiNotar CA from trusted list
Details:
https://threatpost.com/en_us/blogs/attackers-obtain-valid-cert-google-domains-mozilla-moves-revoke-it-082911
http://www.coriolis-systems.com/blog/2011/08/diginotar-certificate-security.php
2011-08-30 08:53:21 -07:00
Nathan Rajlich
0c91a835ff util: isRegExp() should not call toString() on its argument
An overloaded toString() method may have side effects
so don't call it for a simple type check.

Back-port of 54b409d to the v0.4 branch.
2011-08-25 19:23:31 +02:00
Ryan Dahl
827b9c5f1f net: fix throw error
Thanks Tobi
2011-08-23 14:30:12 -07:00
koichik
509a676128 Doc improvements 2011-08-23 01:15:32 +09:00
Ryan Dahl
ce9caa237f Fix #1563. overflow in ChildProcess custom_fd.
Backported from master f5db3f1f85
2011-08-20 12:42:58 -07:00
Maciej Małecki
e150bc4f2b docs: process.memoryUsage returns memory usage measured in bytes 2011-08-20 01:00:21 +02:00
isaacs
b4712bf1ac Close #1544 Document slashesDenoteHost flag in url.parse 2011-08-17 18:47:48 -07:00
Ryan Dahl
dc578724b1 Now working on v0.4.12 2011-08-17 18:45:28 -07:00
Ryan Dahl
a745d19ce7 Bump version to v0.4.11 2011-08-17 18:18:10 -07:00
Ryan Dahl
9cd510846e Fixes #1546. Remove expensive debug call. 2011-08-17 13:21:15 -07:00
Ben Noordhuis
5e37e10e41 module: fix pointer reference to out-of-scope variable
Reported by Tom Hughes.
2011-08-15 20:08:18 +02:00
Mickaël Delahaye
e8d268fd5f Fix docs for fs.*chown
Fix bad parameters of fs.chown[Sync], fs.fchown[Sync] and
fs.lchown[Sync] in documentation.

Fixes #1533.
2011-08-15 22:45:41 +09:00
koichik
4d186f270f Docs: Not memcpy, but memmove
Fixes #1520.
2011-08-14 23:10:36 +09:00
Ben Noordhuis
028b33b18a test: add test for #1202, uncatchable exception on bad host name 2011-08-12 15:46:18 +02:00
Ben Noordhuis
4e204f37fd net: defer DNS lookup error events to next tick
net.createConnection() creates a net.Socket object
and immediately calls net.Socket.connect() on it.

There are no event listeners registered yet so
defer the error event to the next tick.

Fixes #1202.
2011-08-12 15:42:45 +02:00
Ben Noordhuis
e00c2ec5e3 build: remove 1024 char read limit from cmake file 2011-08-12 15:32:43 +02:00
Arnout Kazemier
7ba30a4c2e Small changes for fs.watchFile. Fixed broken markdown. Changed variable f to a proper filename.
Fixes #1507.
2011-08-12 21:57:58 +09:00
isaacs
3210809d0a Fix #1497 querystring: Replace 'in' test with 'hasOwnProperty' 2011-08-11 15:31:29 -07:00
koichik
d1a2628499 Doc improvements
related to #1472.
2011-08-12 02:00:42 +09:00
Christopher Wright
0d8d04e585 Correct code span
Fixes #1489.
2011-08-11 16:29:37 +09:00
Tom Hughes
421b6e89aa crypto: fix incorrect ssl shutdown check 2011-08-09 23:56:00 +02:00
Tom Hughes
25118b0a26 net: fix incorrect sizeof() 2011-08-09 23:56:00 +02:00
Ben Noordhuis
fc57df283c docs: rename readline.md to readline.markdown 2011-08-08 00:59:14 +02:00
Tom Hughes
b267dc458d cmake: Various fixes.
* Allow overriding install path with CMAKE_INSTALL_PREFIX.
* make sure js2min.py can be found when building out of source.
* Replace empty macros with void(0).
  Expressions like "debug(x) && foo()" fail if debug(x) is an empty macro.
* Make sure node-natives.h creation is deterministic.
* Fix version string.
  The copyright header made the node_version.h file larger
  than the previously set file read limit.
2011-08-08 00:57:30 +02:00
Logan Smyth
3056c2ca76 Add documentation for SecurePair and its 'secure' event.
Fixes #1443.
2011-08-06 23:31:17 +09:00
koichik
c72223e2a9 Doc improvements
related to #1391, #1415.
2011-07-30 03:18:33 +09:00
koichik
8b3ba47f88 Fix http.ClientRequest crashes if end() was called twice
Fixes #1417.
Fixes #1223.
2011-07-30 00:07:37 +09:00
Tom Hughes
eab8bebced Fix memleak in libeio. 2011-07-27 23:24:55 +02:00
Ben Noordhuis
2d65f3c59a Include "platform.h", not <platform.h> - conflicts with system headers
Fixes #1003.
2011-07-26 22:09:03 +02:00
koichik
d32971a8cb Doc improvements and change argument name.
Fixes #1318.
2011-07-25 23:57:25 +09:00
Ben Noordhuis
deb100fb17 eio: remove trailing comma from enumerations
Fixes compile-time error in strict mode. Fixes #567.
2011-07-25 15:37:21 +02:00
isaacs
bf0802402d Note that require.paths is gone in 0.5
Rather than say it "may disappear", let's just be clear that it *has*
disappeared, and exactly how long it'll be supported for.
2011-07-24 17:18:33 -07:00
SAWADA Tadashi
e357acc55b Fix crypto encryption/decryption with Base64.
Fixes #738.
Fixes #1205.
2011-07-23 21:56:41 +09:00
Vicente Jimenez Aguilar
b8e9bf0993 Typos in ChangeLog file.
Fixes #968.
2011-07-23 21:16:45 +09:00
Bert Belder
78487b6256 Windows/cygwin: no more GetConsoleTitleW errors on XP 2011-07-22 16:33:55 +02:00
koichik
691497babe Doc improvements
corresponds to #1374 and #1334.
2011-07-22 00:20:47 +09:00
Trent Mick
bbf7e8ed5e http: fix setting ServerResponse.statusCode in writeHead
Fixes #1374.
2011-07-21 14:20:40 +02:00
Ryan Dahl
effc4469d0 Now working on v0.4.11 2011-07-20 00:37:26 -07:00
Ryan Dahl
1b8dd65d6e Bump version to v0.4.10 2011-07-19 23:51:42 -07:00
isaacs
ddfc6b78cc Close #1360 url: Allow _ in hostnames. 2011-07-19 11:56:44 -07:00
Reid Burke
973153d1cc Properly respond to HEAD during end(body) hot path
During write(), _hasBody is checked to make sure a body
is allowed -- this is now also checked during end(body)
when write() isn't used.

Concise final chunk for HEAD req's res.end(data).

Instead of simply clearing data, check _hasBody
earlier to avoid sending cruft when chunkedEncoding
is used.

Fixes #1291.
2011-07-20 00:24:17 +09:00
Ben Noordhuis
9f9a4cb928 Fix Math.pow crashes on machines without SSE2.
This is a back-port of r8577 from V8's upstream 3.1 branch.

Fixes #829.
2011-07-16 16:00:06 +02:00
koichik
e8bc80cf15 Doc improvements
Fixes #1334.
2011-07-16 09:45:43 +09:00
Wojciech Wnętrzak
9a16f1c7d0 added information about relative paths in File System module 2011-07-15 09:54:20 -07:00
koichik
8caf7fdb05 Add tests for #1085 and #1304
Fixes #1327.
2011-07-15 01:58:43 +09:00
Stefan Rusu
5b02d564c3 Fixes #1085. The agent end event may call detachSocket() after the socket is detached and destroyed by abort(). This patch avoids that behavior. 2011-07-15 00:33:28 +09:00
Stefan Rusu
901ebed8ff Fixes #1304. The Connection instance may be destroyed by abort() when process.nextTick is executed. 2011-07-15 00:32:46 +09:00
Kip Gebhardt
7097eca5a7 Adding documentation for 'agent' option in http.request().
Fixes #1243.
2011-07-14 04:06:46 +09:00
koichik
5208abe723 Fix Buffer drops last null character in UTF-8
Reproduce:

    $ node
    > buf = new Buffer('\0')
    <Buffer >
    > buf.length
    0
    > buf = new Buffer(1)
    <Buffer 28>
    > buf.write('\0')
    0

Fixes #394.
Fixes #1210.
2011-07-14 02:21:56 +09:00
koichik
5f97c9a005 Improvements AssertionError message
Fixes #217.
2011-07-14 02:08:24 +09:00
koichik
128d1bab2a The Node.JS website should link to whichever ChangeLog will be updated soonest.
Fixes #1316.
2011-07-14 02:00:57 +09:00
koichik
701ae3c995 Document error in console.timeEnd
Fixes #1109.
2011-07-14 00:10:17 +09:00
AJ ONeal
8cc9ac0df2 added explanation of exports
Fixes #1075.
2011-07-14 00:08:31 +09:00
koichik
d05afa50e6 Doc improvements
Fixes #297.
2011-07-14 00:06:12 +09:00
Ryan Dahl
6bcd96c253 Update favicon 2011-07-11 12:24:49 -07:00
Ryan Dahl
360f4b78dd Fix wallpaper links 2011-07-11 08:48:02 -07:00
Ryan Dahl
b1c90a4e22 logo update 2011-07-11 08:30:37 -07:00
koichik
7e8735b3fe Doc improvements. Explained the flags of fs.open().
Fixes #1268.
2011-07-09 17:09:26 +09:00
koichik
87b6dc21c8 Doc improvements
moved 'continue' event from http.Agent to http.ClientRequest.
added 'close' event to http.ClientResponse.
added 'open' event to fs.ReadStream.

Fixes #1169.
2011-07-09 13:23:28 +09:00
isaacs
fc80ee947a docs for chown/chmod 2011-07-08 22:41:30 +02:00
Ben Noordhuis
b62ecdc5bb Revert 3e2a2a7. Always send a HTTP/1.1 status line to the client. 2011-07-07 23:54:13 +02:00
Ryan Dahl
073fbea0f5 Bring back execScript
Undoing
http://codereview.chromium.org/7060008
https://groups.google.com/forum/#!topic/v8-dev/JTRHrPHFBts
2011-07-06 16:55:50 -07:00
Yoshihiro Kikuchi
82cfdb88fa fix an broken question.
Fixes #1274.
2011-07-06 09:24:37 +09:00
Alex Xu
1c174cc1aa Typo: stout -> stdout
Closes #874
2011-07-05 02:42:32 +02:00
Ben Noordhuis
3e2a2a76fd Test cases for #1234: don't send HTTP/1.1 responses to HTTP/1.0 clients. 2011-07-05 01:41:37 +02:00
Ben Noordhuis
f91988979f Don't send a HTTP/1.1 status line to HTTP/1.0 clients.
Fixes #1234.
2011-07-05 01:41:30 +02:00
Ben Noordhuis
c6846565cf Clean up temporary file on exit.
Unbreaks test/simple/test-http-get-pipeline-problem.js,
it assumed a fixed number of files in the tmp directory.
2011-07-05 01:38:07 +02:00
Joe Shaw
7962eeef22 Fix a misnamed argument; multicastAddress -> multicastInterface. Closes #1237. 2011-07-04 10:00:31 -07:00
Jörn Horstmann
8cecc50b9d Fixed a typo in a comment: "realpatch" -> "realpath" 2011-07-04 09:53:30 -07:00
Mariano Iglesias
075605f304 Adding missing v8 namespace to NODE_PSYMBOL 2011-07-04 09:50:10 -07:00
Brett Kiefer
220e2281e4 Fix issue 915 (Failed to find kqueue on FreeBSD) with the relevant portion of a patch submitted to node.js dev (http://groups.google.com/group/nodejs-dev/browse_thread/thread/3aaf7fe2ca390fdc) by Davie Siegel. The issue is that event.h requires types.h on FreeBSD. This rearranges some of the logic but looks like it should still be valid for Darwin. 2011-07-04 09:27:15 -07:00
koichik
38a0145869 Fix doctool uses RegExp object as a Function
RegExp object is no longer Function.
http://code.google.com/p/v8/issues/detail?id=617

Fixes #1262.
2011-07-03 11:27:23 -07:00
koichik
432d54900e Remove duplicate section in modules.markdown
Fixes #1263
2011-07-03 11:26:44 -07:00
Ryan Dahl
efca5456b8 Fixes #877. Don't wait for socket pool to establish connections.
Thanks to Yann Biancheri for putting together an initial test.
2011-07-01 15:49:42 -07:00
Ryan Dahl
f78f654131 Revert "debugger: don't allow users to input non-valid commands"
breaks 'print' command

This reverts commit 37d529f818.
2011-07-01 15:38:53 -07:00
Yoshihiro KIKUCHI
99b210d7ea tiny fixes in tty_posix.js
Close #1158
Close #1160
Close #1252
2011-07-01 00:33:41 -07:00
Ryan Dahl
e286480e34 Now working on v0.4.10 2011-06-29 14:44:38 +02:00
Ryan Dahl
de44eafd78 Bump to v0.4.9 2011-06-29 13:24:02 +02:00
Ryan Dahl
1e7769dfa3 Merge branch 'v8-3.1' into v0.4 2011-06-29 12:49:37 +02:00
Ryan Dahl
61553ccdda Upgrade V8 to 3.1.8.25 2011-06-29 12:49:17 +02:00
koichik
d6ec8f668e Fix -e/--eval can't load module from node_modules
With -e or --eval, require() can load module using relative path.

    node -e 'require("./foo")'

But it can't load module from node_modules directory.

    node -e 'require("foo")'

Fixes #1196.
2011-06-20 13:47:27 +02:00
Ryan Dahl
d627083ed5 Fixes #1187. Support multiple 'link' headers 2011-06-20 12:51:30 +02:00
Ryan Dahl
feb26d6c74 Fixes #1203. Add missing scope.Close to fs.sendfileSync 2011-06-20 12:48:38 +02:00
Mark Cavage
7c51275bce Cleanup crypto verify to not print unnecessary errors 2011-06-15 20:02:21 +02:00
Mathias Buus
39246f65df Closes #1177 remove one node_modules optimization
to better support certain project structures.
2011-06-14 15:32:41 -07:00
Mark Cavage
88552c51ae Support for signature verification with RSA/DSA public keys
Fixes #1166.
2011-06-14 12:50:00 +02:00
Trevor Burnham
f46811633c Documenting require.main, fixing #997 2011-06-13 13:39:02 -07:00
Ryan Dahl
1ba2c32135 Massage util.inherits for perf increase 2011-06-11 08:51:48 +02:00
Siddharth Mahendraker
37d529f818 debugger: don't allow users to input non-valid commands
Fixes #1144.
2011-06-03 14:50:12 +02:00
Ryan Dahl
1d7a46a588 Disabling SSL compression is dependent on OpenSSL version 0.9.8
Fixes #1087.
2011-06-03 14:50:02 +02:00
Ryan Dahl
4956e3c0a2 Upgrade http-parser to eee60127c0df551be085cc8e7983e36d7700d885 2011-06-03 14:12:14 +02:00
Ryan Dahl
0cb4484d43 Doc improvements
Fixes #1147.
Fixes #1139.
Fixes #1126.
Thanks ctide, kext, disfated.
2011-06-03 13:27:35 +02:00
Jérémy Lal
f23c45f7f4 Option to disable SSL v2
Fixes #880
2011-06-03 08:37:28 +02:00
Ryan Dahl
b96ae6674d document require.cache 2011-06-03 08:14:35 +02:00
Ryan Petrello
58a1d7ec30 Close #562 Close #1078 Parse file:// urls properly
The file:// protocol *always* has a hostname; it's frequently
abbreviated as an empty string, which represents 'localhost'
implicitly.

According to RFC 1738 (http://tools.ietf.org/html/rfc1738):

A file URL takes the form:

   file://<host>/<path>

where <host> is the fully qualified domain name of the system on
which the <path> is accessible...

As a special case, <host> can be the string "localhost" or the empty
string; this is interpreted as 'the machine from which the URL is
being interpreted'.
2011-05-27 10:47:34 -07:00
Ben Noordhuis
eb4c9ed881 Fix resource leaks in node_crypto.cc
Fixes #1097.
2011-05-24 23:36:54 -07:00
Brian White
9b3472637e Crypto documentation fixes
Fixes #1104.
2011-05-24 23:35:18 -07:00
Felix Geisendörfer
2b91256c61 Fix error handling bug in stream.pipe()
Problem: Since stream.pipe() is registering it's own error handlers on
the source and destination stream, it needs to replicate the
EventEmitter 'error' emitting semantics of throwing an error if there
are no other listeners. However, there was a off-by-one error because
the check for remaining listeners was done after cleanup() which means
the pipe's own listener was no longer included.

This would cause 'error' events on either the dest or the source to
throw if there was one other error listener, and while swallowing
the 'error' event if there was no other listener.

Solution: I added a test demonstrating the two issues and fixed the
problem by correcting the off-by-one error.

Fixes #1095.
2011-05-24 10:50:33 -07:00
Brian White
d22259426c Fix incorrect documentation for assert.fail()
Fixes #1100.
2011-05-24 10:44:14 -07:00
Ryan Dahl
823604a4e0 Now working on v0.4.9 2011-05-21 00:10:23 -07:00
Ryan Dahl
7dd22c26e4 Bump to v0.4.8 2011-05-20 19:40:06 -07:00
Ryan Dahl
80b0225b98 Merge branch 'v8-3.1' into v0.4 2011-05-20 19:25:30 -07:00
Ryan Dahl
cee4ce39a9 Upgrade V8 to 3.1.8.16 2011-05-20 19:24:37 -07:00
Ryan Dahl
70dd6d4ea3 Fix TJ's assert error
Unable to reproduce but connect's "make test TESTS=test/static.test.js" does
it occasionally.
2011-05-20 15:41:04 -07:00
Mark Cavage
a55a9ff3c2 Additional docs for net.listenFD()
Fixes #1080.
2011-05-20 15:02:22 -07:00
Ryan Dahl
9c7f89bf56 CryptoStream.prototype.readyState shoudn't reference fd
Fixes #1069
2011-05-20 10:20:22 -07:00
Brian White
2de0611b43 Remove unused variable
Fixes #1077
2011-05-20 08:51:55 -07:00
David Trejo
8a0ac5b422 Add test for agent upgrade and example in docs 2011-05-19 18:44:42 -07:00
Alexandre Marangone
6c28fcf661 (char *) casting for all strings args to kstat function to avoid warnings
Fixes #1071.
2011-05-19 14:53:31 -07:00
Alexandre Marangone
5d9dc1c6d5 Adding os.totalmem() and os.freemem() for SunOS 2011-05-19 14:53:07 -07:00
Fedor Indutny
21724ecaec Share SSL context between server connections
Fixes #1073.
2011-05-19 14:45:42 -07:00
Ryan Dahl
6461af1baa Fix buffer test 2011-05-19 12:41:17 -07:00
Ryan Dahl
5e409c2f1a makeFastBuffer should not segfault but rather throw on non-buffer 2011-05-19 12:13:48 -07:00
David Trejo
f4e69e44ff readline docs 2011-05-18 21:13:49 -07:00
Ryan Dahl
63c0d71213 Changes for job bullets 2011-05-17 13:25:25 -07:00
Ryan Dahl
103a450d3a Remove 'binary' encoding assert - add tests
Don't write large characters to buffers with binary encoding. You will be
silently injured.
2011-05-16 15:01:33 -07:00
isaacs
249361cab7 Close #1054 More clear documentation for module system 2011-05-16 23:30:43 +02:00
Ryan Dahl
e83c6959db Disable compression with OpenSSL.
This improves memory and speed. Users may apply compression in "userland"
above the CryptoStream layer if they desire.
2011-05-16 10:33:19 -07:00
koichik
d4f82ea590 Fix dns.resolve() with 'PTR' throws Error: Unknown type "PTR"
Fixes #1038
2011-05-16 10:21:16 -07:00
koichik
80c2fe9456 Fix event listener leak check timing
Fixes #1041.
2011-05-14 14:43:00 -07:00
koichik
56aa2fd4c3 Fix doc - missing dns.resolveNs() and dns.resolveCname()
Fixes #1039.
2011-05-14 14:36:58 -07:00
Felix Geisendörfer
9d717f6bef Update http.ServerRequest docs
The documentation for 'end' was wrong, and 'close' now has an `err`
parameter.
2011-05-14 14:21:41 -07:00
Felix Geisendörfer
e7ac6d8fcd Error argument for http.ServerRequest 'close'
Problem: It was not possible to detect the reason for a premature
connection termination in http requests.

This patch provides a new `err` argument to the 'close' event which
can be inspected to differentiate between a timeout and a client
actively terminating the connection.

Also contains tests for this new behavior for http and https.
2011-05-14 14:15:31 -07:00
Felix Geisendörfer
1fde5f51b4 Make https 'timeout' events bubble up
Also adds a test case for it.
2011-05-14 13:38:04 -07:00
Ryan Dahl
9a3dd754be Add trademark stuff to homepage 2011-05-11 13:40:42 -07:00
isaacs
307f39ce9e Fix a url regression
The change for #954 introduced a regression that would cause
the url parser to fail on special chars found in the auth
segment.  Fix that, and also don't create invalid urls when
format() is called on an object containing an auth member
containing '@' characters or delimiters.
2011-05-10 13:57:25 -07:00
Ryan Dahl
11beac70e2 Docs: server.pause() server.address() socket.address() 2011-05-09 10:49:27 -07:00
Trevor Burnham
31ed87b0a9 Documenting require.main, fixing #997 2011-05-09 10:29:09 -07:00
Ryan Dahl
110f06578d Agent socket errors bubble up to req only if req exists
Fixes #836.
2011-05-07 12:30:58 -07:00
Marcel Laverdet
c2b5ea218c Attempt to connect to debug process more than once
The debugger would give up after only 100ms but on my system this
timeout isn't enough. The startup process is now modified to try 6
times every 50ms instead.

Fixes #1010.
2011-05-06 20:53:40 -07:00
Ryan Dahl
5ab3ea3955 Point changelog to correct branch
Fixes #1002. Thanks cjavapro.
2011-05-06 16:05:04 -07:00
Ryan Dahl
55bff5bab9 TLS: simplify logic 2011-05-06 17:06:36 -07:00
Ryan Dahl
fc8afd45c7 Fix crash in debugger 2011-05-05 16:52:05 -07:00
Ryan Dahl
ad487d3226 Add on('error') to http request example
for indexzero
2011-05-05 15:40:55 -07:00
Ryan Dahl
c409aab397 Assert, Debug output in normal default build 2011-05-04 21:41:01 -07:00
Ryan Dahl
75a0cf970f cleartextstream.destroy() should destroy socket.
This fixes a critical bug see in MJR's production. Very difficult to build a
test case. Sometimes HTTPS server gets sockets that are hanging in a
half-duplex state.
2011-05-02 15:03:50 -07:00
Ben Noordhuis
82bc25d5ad Remove oprofile flags in wscript.
V8 3.1.5 (commit 550f73a) dropped oprofile support so don't pass
prof=oprofile to scons.

See http://codereview.chromium.org/6474037/

Fixes #998.
2011-05-01 08:00:34 -07:00
Ryan Dahl
8d88c00b77 Merge branch 'v8-3.1' into v0.4 2011-04-30 11:38:55 -07:00
Ryan Dahl
eb57d1b9b1 Upgrade V8 to 3.1.8.14 2011-04-30 11:38:25 -07:00
koichik
fcc04e67c8 Fix SlowBuffer.write() with 'ucs2' throws ReferenceError. 2011-04-28 04:57:00 -04:00
koichik
1343ee8d54 Doc improvements. 2011-04-28 04:54:28 -04:00
isaacs
7c6f0147df Better stream.pipe() tracking.
This commit does three things:

1. Uses an exposed counter rather than a hidden array for tracking dest
streams that may have multiple inputs.  This allows for significantly
faster lookups, since the counter can be checked in constant time rather
than searching an array for the dest object.  (A proper O(1) WeakMap
would be better, but that may have to wait for Harmony.)

2. Calls the 'end' event logic when there is an 'error' event on the
source object (and then throws if there are no other error listeners.)
This is important, because otherwise 'error' events would lead to
memory leaks.

3. Clean up the style a bit.  Function Declarations are not allowed
within blocks in ES strict.  Prefer Function Declarations to Function
Expressions, because hoisting allows for more expressive ordering of
logic.

Downside: It adds "_pipeCount" as part of the Stream API.  It'll work
fine if the member is missing, but if anyone tries to use it for some
other purpose, it can mess things up.
2011-04-27 22:08:21 -07:00
isaacs
bbffd9e502 Close #983 Better JSON.parse error detection
Previous pattern would only catch ILLEGAL, not { or other
known-but-unexpected JSON tokens.
2011-04-26 09:48:28 -07:00
George Miroshnykov
68c8a69f4c Close #962: Fixed typo in vm.runInNewContext docs.
EDIT: Also added another typo fix to this commit. --isaacs
2011-04-25 13:45:58 -07:00
isaacs
8df6f9e544 Close #974 Properly report traceless errors.
Also, tests for the same.
2011-04-25 12:22:18 -07:00
isaacs
8fd1c68f06 A test that running 100 stream pipes in parallel is ok 2011-04-22 19:33:23 -07:00
Ryan Dahl
0325a21ff3 Correct attribution 2011-04-22 19:04:43 -07:00
Ryan Dahl
621b024b6e Bump bounds on #897 test - was too small for slow machines 2011-04-22 17:50:40 -07:00
Ryan Dahl
1f470b68d6 Now working on v0.4.8 2011-04-22 17:49:56 -07:00
Ryan Dahl
c85455a954 bump version to v0.4.7 2011-04-22 17:06:25 -07:00
Ryan Dahl
c8e447ee63 Fix timeouts with floating point numbers bug
fixes #897.
2011-04-22 16:38:29 -07:00
Ryan Dahl
3ce5e6fe5e Use better ports on the home page 2011-04-22 16:01:34 -07:00
Robert Mustacchi
ed657e9d46 Add loadavg for SunOS 2011-04-21 19:52:01 -07:00
Tim Baumann
6c7c4aeab6 Don't overwrite an user-specified repl.writer 2011-04-21 12:26:27 -07:00
Wade Simmons
d00739ce56 make it possible to do repl.start('', stream) 2011-04-21 12:20:50 -07:00
isaacs
90802d628d Close #954 URL parsing/formatting corrections
1. Allow single-quotes in urls, but escape them.
2. Add comments about which RFCs we're following for guidance.
3. Handle any invalid character in the hostname portion.
4. lcase protocol and hostname portions, since they are
case-insensitive.
2011-04-20 15:44:34 -07:00
Ryan Dahl
d3d35ec3ca add docs for console object 2011-04-18 16:52:53 -07:00
Ryan Dahl
cbdd92e184 Add community link on homepage 2011-04-16 13:55:03 -07:00
Ryan Dahl
ed316ae350 Docs: some encodings contains multibyte chars.
fixes #888
2011-04-14 15:11:35 -07:00
koichik
74d94b0dd1 Fix docs - Move module's description to right position 2011-04-14 14:40:50 -07:00
Felix Geisendörfer
6c5b31bd80 Fix: Multiple pipes to the same stream were broken
When creating multiple .pipe()s to the same destination stream, the
first source to end would close the destination, breaking all remaining
pipes. This patch fixes the problem by keeping track of all open
pipes, so that we only call end on destinations that have no more
sources piping to them.

closes #929
2011-04-14 14:12:01 -07:00
Ryan Dahl
8417870f51 Don't emit error on ECONNRESET - just close
Fix #670
2011-04-14 10:42:57 -07:00
Ryan Dahl
61100788ad Now working on v0.4.7 2011-04-13 22:03:48 -07:00
Ryan Dahl
58002d56bc Bump to v0.4.6 2011-04-13 21:20:05 -07:00
Ryan Dahl
bb621f7c2e CryptoStream.write returns false when queue > 128kb
Previously the return value of write was dependent on if it was paused or
not which was causing a strange error demoed in the previous commit.

Fixes #892
2011-04-13 20:32:46 -07:00
Ryan Dahl
050bbf0bc4 TLS use RC4-SHA by default 2011-04-13 18:43:08 -07:00
Theo Schlossnagle
d0e84b0088 Pass secureProtocol through on tls.Server creation
The secureProtocol option to building the SSL context was not being properly
passed through in the credentials in the tls code. This is fixed.
2011-04-13 17:49:50 -07:00
Scott McWhirter
90348a616d Add os.cpus() and os.uptime() support for sunos 2011-04-13 17:42:54 -07:00
Ryan Dahl
2f98451561 Revert "Add os.cpus() and os.uptime() support for sunos"
Cherry-pick fail. Breaks linux. Will land again shortly.

This reverts commit e8cf98c841.
This reverts commit d953856d87.
This reverts commit 752bbd6b42.
2011-04-13 17:31:09 -07:00
Scott McWhirter
e8cf98c841 Add os.cpus() and os.uptime() support for sunos 2011-04-14 00:18:19 +00:00
Ryan Dahl
296ff04cdc Test to demonstrate #892 2011-04-13 12:49:13 -07:00
koichik
9533e879f0 Fix Buffer.write() with UCS-2 should not be write partial char
closes #916.
2011-04-13 09:55:49 -07:00
Felix Geisendörfer
301f53c2aa Allow omission of end option for range reads
Problem: Sometimes it is useful to read a file from a certain position
to it's end. The current implementation was already perfectly capable
of this, but decided to throw an error when the user tried to omit
the end option. The only way to do this, was to pass {end: Infinity}.

Solution: Automatically assume {end: Infinity} when omitted, and remove
the previous exception thrown. Also updated the docs.

closes #801.
2011-04-13 09:46:28 -07:00
Ryan Dahl
af96447016 Modify text about buffer.write and partial chars
Fixes GH-913.
2011-04-13 01:27:00 -07:00
Jakub Lekstan
81cbd42cf5 Fixes the circular reference in vm modules.
Fixes the circular reference problem. Closes GH-822.
2011-04-12 15:51:57 -07:00
Ryan Dahl
9b3b37e498 Add docs about Buffer._charsWritten
Fixes GH-907.
2011-04-12 15:21:04 -07:00
Abe Fettig
83727a4c86 Fix bug where http response.readable was never set to false
Closes GH-867.
2011-04-12 14:55:18 -07:00
Ryan Dahl
0f47f63746 Fix doc - no setBodyEnocoding anymore
Thanks Frederic. Closes GH-859.
2011-04-11 17:30:36 -07:00
koichik
682b66c0c1 Auto completion of built-in debugger suggests prefix match rather than partial match. 2011-04-11 17:28:28 -07:00
koichik
ca028f4b37 Fix docs: There were 2 descriptions of 'request' event. 2011-04-11 17:27:24 -07:00
Scott McWhirter
d953856d87 Remove extra kstat_open 2011-04-11 17:03:50 -07:00
Scott McWhirter
752bbd6b42 Add os.cpus() support for sunos 2011-04-11 17:03:50 -07:00
Ryan Dahl
d2298d225c Add documentation around module.exports and scope of global objects
Closes GH-852.
2011-04-11 17:01:25 -07:00
Ryan Dahl
6b5a7033bb Merge branch 'v8-3.1' into v0.4 2011-04-11 16:08:10 -07:00
Ryan Dahl
0b1920b202 Upgrade v8 to 3.1.8.10 2011-04-11 16:07:54 -07:00
Ryan Dahl
9ccf0e527f Don't error on ENOTCONN from shutdown() 2011-04-11 15:33:24 -07:00
Ryan Dahl
dcc2dd5e1f Add example to sha1 docs 2011-04-03 01:09:00 -07:00
George Stagas
3002c01f40 Changed script to vm and corrected order to match index 2011-04-02 02:35:44 -07:00
George Stagas
21e3b668cb Added favicon.ico 2011-04-02 02:35:23 -07:00
Ryan Dahl
ffb3ee6084 Remove reference to CommonJS in documentation 2011-04-01 22:18:23 -07:00
Ryan Dahl
61d0b5af87 Now working on version v0.4.6 2011-04-01 19:06:41 -07:00
Ryan Dahl
787a343b58 Bump version to v0.4.5 2011-04-01 18:00:43 -07:00
isaacs
6d85da185c Closes GH-721 Set default host header properly
However, this test is failing for some quite unrelated issue.
Getting some odd "socket hangup" crashes, and only the first request
ever makes it to the server.
2011-04-01 17:40:41 -07:00
isaacs
e1a72f0e2e Closes GH-535 Immediate pause/resume race condition
Calling resume() immediately after calling pause() would trigger
a race condition where it would try to read() from a file
descriptor that was already being read from, causing an EBADF
2011-04-01 17:40:19 -07:00
isaacs
4d64f36338 Closes GH-310 Format slashes properly 2011-04-01 17:40:19 -07:00
Ryan Dahl
a7254f3df9 Revert "Disable compression with OpenSSL."
This reverts commit 362785f704.
2011-04-01 12:38:42 -07:00
Ryan Dahl
362785f704 Disable compression with OpenSSL.
This improves memory and speed. Users may apply compression in "userland"
above the CryptoStream layer if they desire.
2011-04-01 09:49:25 -07:00
Ryan Dahl
4877279efa Add timers to globals section
Closes GH-864.
2011-04-01 09:19:08 -07:00
Ryan Dahl
5c35dff419 Don't load root certs for each SSL context 2011-03-31 23:40:19 -07:00
Ryan Dahl
ad861e1354 Merge branch 'v8-3.1' into v0.4 2011-03-31 10:07:59 -07:00
Ryan Dahl
6631983dd1 Upgrade V8 to 3.1.8.8 2011-03-31 10:07:48 -07:00
Ryan Dahl
ed74db01f3 process.stderr.write should return true 2011-03-30 15:53:07 -07:00
Ryan Dahl
6394ba28c8 Add test for circular refs in deepEquals
Closes GH-207.
2011-03-30 10:18:58 -07:00
Jorge Chamorro Bieling
e35b2d9617 docs: fs.read/write() cb()s now receive buffer 2011-03-29 12:23:42 -07:00
Ryan Dahl
038306a6c3 Closes GH-843. Fix SlowBuffer.prototype.slice 2011-03-29 10:47:14 -07:00
Ryan Dahl
1768c72135 Add doc note about STARTTLS 2011-03-29 09:58:50 -07:00
Ryan Dahl
c0b461d9a1 Increase TLS pool size for perf increase 2011-03-28 17:37:14 -07:00
Ryan Dahl
98b56636c0 Revert "Alphabetize the table of contents for the API docs"
This reverts commit a66e45693c.
2011-03-28 17:36:50 -07:00
Ryan Dahl
e9a1dd7930 Typo in docs
Thanks to Anatoliy Chakkaev for pointing it out.

Closes GH-841.
2011-03-28 15:59:43 -07:00
Brian White
a66e45693c Alphabetize the table of contents for the API docs 2011-03-28 15:56:39 -07:00
Ryan Dahl
2f2c9d47fd Remove strange unicode output in docs 2011-03-28 15:55:45 -07:00
David Trejo
6788ad413f See the <doc> section are now links to <doc>
Closes GH-839.
2011-03-28 15:53:17 -07:00
Ryan Dahl
978a50c500 Remove exterraneous line 2011-03-28 15:46:36 -07:00
Jorge Chamorro Bieling
e7604b1ea7 Retain buffers in fs.read/write()
Closes GH-814.
Closes GH-827.
2011-03-28 15:28:55 -07:00
Mikeal Rogers
2a65d29625 Fix listener leak in stream.pipe() 2011-03-28 11:19:44 -07:00
Ryan Dahl
73ebea7a4d Now working on v0.4.5 2011-03-26 02:00:11 -07:00
Ryan Dahl
25122b986a Bump version to v0.4.4 2011-03-26 01:48:02 -07:00
Ryan Dahl
77044ed5fa Turn off strictaliasing on solaris 2011-03-26 01:42:08 -07:00
Ryan Dahl
cbcb7fb019 Merge branch 'v8-3.1' into v0.4 2011-03-25 12:02:51 -07:00
Ryan Dahl
c8ee19a618 Upgrade V8 to 3.1.8.5 2011-03-25 12:02:38 -07:00
Arnout Kazemier
53bec1c862 Added support for removing .once listeners
Closes GH-806.
2011-03-25 11:51:29 -07:00
Ryan Dahl
0fb44a2f93 Add jobs.nodejs.org link 2011-03-23 19:24:09 -07:00
Ryan Dahl
69c3e1961b Remove asciiSlice from docs 2011-03-23 15:02:11 -07:00
Zachary Scott
2b2736153d clean up whitespace in examples 2011-03-22 14:39:30 -07:00
Zachary Scott
67913a0232 writable stream api has destroySoon() for exiting after data queue has been drained 2011-03-22 14:38:59 -07:00
Trevor Burnham
5e78f57087 Doc fix for fs.write
Closes GH-808
Closes GH-811
2011-03-22 14:34:25 -07:00
Trevor Burnham
f0d0fcc4aa Clarifying that writeFile replaces existing file 2011-03-22 14:33:23 -07:00
Trevor Burnham
3ec391ba36 Correcting typo in docs: 'deprecated', not 'depreciated' 2011-03-22 14:33:23 -07:00
Ryan Dahl
8b33a1d8e4 Guard failed buffer constructions.
Thanks to Jeremy Barnes for pointing it out.
2011-03-22 13:10:53 -07:00
Ryan Dahl
391f087981 Fix setsid in tty.open
Thanks to Leen Besselink for pointing this out.
Closes GH-815.
2011-03-22 12:02:35 -07:00
Ryan Dahl
24f9bf4180 expose https.Agent 2011-03-22 11:24:00 -07:00
Ryan Dahl
d7a86ff05e Fix GH-819. Drop out if connection destroyed before connect() 2011-03-21 14:48:26 -07:00
Ryan Dahl
7e28630f5e Fix GH-820. CryptoStream.end shouldn't throw if not writable
This matches the behavior of net.Socket
2011-03-21 14:36:49 -07:00
Ryan Dahl
4198de280f Add video to index.html 2011-03-20 18:07:29 -07:00
Ryan Dahl
99068639d9 add demo to home page 2011-03-19 20:28:31 -07:00
Ryan Dahl
c8f5bf88e1 Use feedburner instead of wordpress 2011-03-18 15:49:26 -07:00
Ryan Dahl
4ae5e085ff Now working on v0.4.4 2011-03-18 15:19:12 -07:00
Ryan Dahl
c095ce1a1b bump version to v0.4.3 2011-03-18 14:25:20 -07:00
Ryan Dahl
5b161b09a3 Merge branch 'v8-3.1' into v0.4 2011-03-18 14:24:37 -07:00
Ryan Dahl
53dc74e12f Upgrade V8 to 3.1.8.3 2011-03-18 14:22:52 -07:00
Ryan Dahl
aeed966fe0 Don't call GetMemoryUsage every 5 seconds 2011-03-18 11:39:44 -07:00
koichik
5ccdff48f3 Document 'ucs2' encoding for Buffer 2011-03-18 11:23:37 -07:00
Dean McNamee
4a6f4511c8 Don't override explicit openssl paths with pkg-config results. 2011-03-18 11:11:10 -07:00
Ryan Dahl
66570c1964 Fix double free of parser on error in http.Agent.
Thanks to Stéphan Kochen for the fix and Maurice Fonk for reproducing the
bug.

Closes GH-784.
Closes GH-803.
2011-03-18 10:42:43 -07:00
Ryan Dahl
975d020286 Fix gcc version checking for aliasing features 2011-03-18 10:01:45 -07:00
Ryan Dahl
af923154e2 hello.txt should be stored in tmpdir 2011-03-18 09:14:15 -07:00
Ryan Dahl
f10150bc6a Don't use https for blog.nodejs.org 2011-03-17 13:49:32 -07:00
Ryan Dahl
c02db3229e Link to Node blog 2011-03-17 13:38:44 -07:00
Ryan Dahl
566c67b758 Working on v0.4.3-pre - oops 2011-03-15 02:53:59 +00:00
Ryan Dahl
61fdfcb137 Fix comment in node_provider.d 2011-03-15 02:50:52 +00:00
Ryan Dahl
55048cdf79 Update copyright headers 2011-03-14 17:37:05 -07:00
Ryan Dahl
36e75b7351 Fix HTTP agent disconnection problem
https://groups.google.com/forum/#!topic/nodejs-dev/V5fB69hFa9o

Closes GH-787.
2011-03-14 14:47:41 -07:00
Felix Geisendörfer
9d4c5a12f4 Crypto update should only accept strings / buffers
I have seen a lot of people trying to pass objects to crypto's update
functions, assuming that it would somehow serialize the object before
hashing.

In reality, the object was converted to '[object Object]' which was
then hashed, without any error message showing.

This patch modifies the DecodeBytes function (used exclusively by
crypto at this point) to complain when receiving anything but a
string or buffer.

Overall this should be a less-suprising, more robust behavior.
2011-03-14 13:16:31 -07:00
Ryan Dahl
2a05fe784d Do not use defineGetter in src/node.js for better crankshaft perf
See: https://groups.google.com/d/topic/nodejs/xJqpp1_s6is/discussion
2011-03-14 12:48:37 -07:00
Theo Schlossnagle
e3925b741c TLS: Finer locks on _cycle.
Data being sent out of order.
2011-03-14 12:05:25 -07:00
Ryan Dahl
2e40328c82 Extend OpenSSL expiration dates 2011-03-14 11:30:21 -07:00
koichik
414fa4abae Better type checks for fd in net.js 2011-03-11 16:34:12 -08:00
koichik
113b1e6e0c Fix GH-746 process.stdin.destroy() breaks http server 2011-03-11 16:33:07 -08:00
Theo Schlossnagle
2a61e1cd49 without this the server will not advertise support for client certs
Closes GH-774.
2011-03-11 16:14:39 -08:00
Ryan Dahl
12c02b378d Use pthread_kill for V8/Solaris sampling 2011-03-11 03:08:42 +00:00
Ryan Dahl
6802c90d1f Sample correct registers on Solaris
http://codereview.chromium.org/6676019/
2011-03-11 03:06:43 +00:00
Ryan Dahl
97853e07de Use default backend for __sun (event ports) 2011-03-11 03:04:25 +00:00
Ben Noordhuis
594642b31d Buffer::Length(Buffer*) should not invoke itself recursively.
Closes GH-759.
2011-03-10 14:06:01 -08:00
Ryan Dahl
9a8e843ca3 Document options for https.request
Closes GH-768.
2011-03-10 13:34:50 -08:00
Ryan Dahl
e14aa64591 Fix V8 runtime profiler for solaris 2011-03-10 12:48:49 -08:00
koichik
4e047d32b0 Document net.Socket() constructor 2011-03-10 10:57:47 -08:00
Ryan Dahl
62f06fb885 CryptoStream.prototype.destroySoon shouldn't die if not writable 2011-03-09 10:53:06 -08:00
Ryan Dahl
161f7aacf7 Add missing v8:: namespace prefix 2011-03-09 10:07:25 -08:00
Tom Hughes
74954ce7d8 Add string class that uses ExternalAsciiStringResource.
Change the natives to use this class instead of creating completely new
strings. Reduces memory usage by about 1 MB.
2011-03-08 13:56:41 -08:00
Ryan Dahl
81d3de7e6d setMaxListeners should initialize _events 2011-03-07 13:16:00 -08:00
Tom Hughes
7a272d92e3 cmake: explicitly disable fdatasync when building for OSX.
This ensures that the check_function_exists() for fdatasync in the
libeio CMakeLists.txt is not run, since that fails on some versions of
OSX (http://public.kitware.com/Bug/view.php?id=10044).
2011-03-07 10:47:29 -08:00
koichik
db6ea10948 Correct some links 2011-03-07 10:17:54 -08:00
koichik
07426ef29c Document allowHalfOpen for net.createServer() 2011-03-07 10:17:22 -08:00
Andreas Reich
5e91042fcb Don't decrease server connection counter again if destroy() is called more than once
Test: Anders Conbere <aconbere@gmail.com>
Fix: Andreas Reich <andreas@reich.name>

Closes GH-431.
Closes GH-502.
2011-03-04 15:45:12 -08:00
Ryan Dahl
39280e1b57 Bump version to v0.4.2 2011-03-02 22:10:26 -08:00
Ryan Dahl
fbe36a7ca9 Revert "Closes GH-85 Emit error rather than throwing."
This reverts commit f3d364122d.

Landed in master instead.
2011-03-02 22:10:16 -08:00
Ryan Dahl
ca8be39b9e Disable test-http-agent2.js for the moment
Still broken.
2011-03-02 21:21:29 -08:00
Bert Belder
b3884c574b Autodetect no-strict-aliasing, propagate toolchain option to SCons
BUG=v8:884
2011-03-02 21:06:17 -08:00
Ryan Dahl
14475c77a6 Upgrade V8 to 3.1.8 2011-03-02 21:04:37 -08:00
Tom Hughes
cf7b680db9 newline should also be treated as "enter" key. 2011-03-02 21:00:06 -08:00
koichik
452df69964 Correct net.createServer() API docs 2011-03-02 12:10:36 -08:00
koichik
4e7c37b87c Fix fs.WriteStream.end(data, [encoding]) throws TypeError 2011-03-01 10:49:20 -08:00
Ryan Dahl
4ab5476e89 SIGUSR1 should break the VM without delay 2011-03-01 09:59:17 -08:00
Ryan Dahl
5f95d9a75d Remove -Werror from V8 2011-02-28 12:58:15 -08:00
isaacs
bc8e9b340d Closes GH-734 Do the setuid() after chdir() 2011-02-28 12:37:59 -08:00
Bert Belder
4a34692903 Autodetect no-strict-aliasing, propagate toolchain option to SCons
BUG=v8:884
2011-02-28 11:30:07 -08:00
Ryan Dahl
6442cbef20 Upgrade V8 to 3.1.7 2011-02-28 11:29:33 -08:00
Ryan Dahl
a14bb04c05 tty.setWindowSize should use the correct function
Thanks to Matthew Woolman
2011-02-28 11:19:10 -08:00
Felix Geisendörfer
0304f1fc22 Expose errno with a string for dns/cares
This is to mirror the behavior introduced in
aa95e5708f.

Closes GH-727.
2011-02-28 09:54:16 -08:00
isaacs
d664bf376d Closes GH-711 URL parse more safely
This does 3 things:

1. Delimiters and "unwise" characters are never included in the
   hostname or path.
2. url.format will sanitize string URLs that are passed to it.
3. The parsed url's 'href' member will be the sanitized url, which may
   not match the argument to url.parse.
2011-02-27 17:17:40 -08:00
isaacs
3599c71dae Closes GH-690 node_modules folders should be highest priority 2011-02-27 17:14:16 -08:00
isaacs
a48f73d0d3 Closes GH-232 Make the repl's global the right thing 2011-02-27 17:13:52 -08:00
isaacs
f3d364122d Closes GH-85 Emit error rather than throwing.
Since "error" events will throw when unhandled anyhow, it makes no sense
to throw from an EventEmitter's method, especially for such a minor
misdemeanor as attempting to write to a non-writable stream.
2011-02-27 17:08:14 -08:00
isaacs
2cfe7b847d Closes GH-184 Clear require cache on repl .clear 2011-02-27 17:07:08 -08:00
koichik
0a51a6d3ac Fix process.stdout.end() throws ENOTSOCK error. 2011-02-27 13:06:08 -08:00
Ryan Dahl
f918e57f8b Support dtrace for debug build 2011-02-25 16:48:19 -08:00
Russell Haering
7276ff9822 http: fix missing 'drain' events 2011-02-24 17:39:59 -08:00
Ryan Dahl
ea9f5b110a Add 'close' and 'aborted' events to Agent responses
Closes GH-722.
2011-02-24 17:16:13 -08:00
Ryan Dahl
839fb8e19b typos 2011-02-24 16:36:43 -08:00
Nathan Rajlich
a9a252fda9 Read up the prototype of the 'env' object.
Closes GH-713.
2011-02-24 16:36:23 -08:00
Aria Stewart
8a50f23fd3 Add support for specifying the libdir
Some OSes use "lib64" rather than "lib", and this lets them override
in waf to accomplish this.

Closes GH-712.
2011-02-24 16:28:45 -08:00
Aria Stewart
fd713e1dc7 libeio and http_parser build with PIC code
Fix building as a shared library

Closes GH-708.
2011-02-24 16:19:43 -08:00
Felix Geisendörfer
66601f13d9 Do not cache modules that throw exceptions
If a module throws an exception on load, it should not be cached.
This patch shows the problem in a test case and also fixes it.

See: https://groups.google.com/forum/#!topic/nodejs-dev/1cIrvJcADbY

Closes GH-707
Closes GH-710
2011-02-24 16:14:04 -08:00
Ryan Dahl
a2f498a5ef Revert "Add extra debug print statement to tls.js"
This reverts commit 340291c085.

sometimes circular. would break node_g tests.
2011-02-24 15:59:40 -08:00
Ryan Dahl
1f50d711b2 Fix memleak in vm.runInNewContext
Closes GH-704.
2011-02-24 15:46:55 -08:00
Bert Belder
df15472d34 Autodetect no-strict-aliasing, propagate toolchain option to SCons
BUG=v8:884
2011-02-24 13:47:14 -08:00
Ryan Dahl
e33e7d1a37 Upgrade V8 to 3.1.6 2011-02-24 13:14:59 -08:00
Felix Geisendörfer
2680522d3a Fix ReadStream bufferSize docs
The default is 64kb buffer, not 4kb.

Closes GH-702.
2011-02-24 12:46:17 -08:00
Felix Geisendörfer
06ac129903 Document existence of fd property for ReadStream
Closes GH-194.
Closes GH-701.
2011-02-24 12:44:21 -08:00
Felix Geisendörfer
f423ec90fc In addition to 'aborted' emit 'close' from incoming requests
Closes GH-160.
2011-02-24 12:41:51 -08:00
Ryan Dahl
5287703cce Pragma HTTP header comma separation
Closes GH-715, GH-716.
2011-02-24 12:02:22 -08:00
Ryan Dahl
45adc907c9 ry/node -> joyent/node 2011-02-23 16:38:34 -08:00
Ryan Dahl
340291c085 Add extra debug print statement to tls.js 2011-02-23 16:38:30 -08:00
cloudhead
a91b140963 fix process.on edge case with signal event
When adding a listener for a signal event, removing it, and
adding it back again, it triggers a condition with an
undefined variable.
2011-02-23 12:57:05 -08:00
Ryan Dahl
0248c87ec7 improve hello-world example on website 2011-02-23 12:56:50 -08:00
Ryan Dahl
ab144f4843 Add TODO item 2011-02-23 04:43:13 -08:00
Ryan Dahl
47f5fd01e1 Add example to TTY documentation 2011-02-20 13:53:40 -08:00
Ryan Dahl
df215a67d4 Document path.existsSync()
Closes GH-677.
2011-02-20 13:11:55 -08:00
Ryan Dahl
4ed6688010 Add V8 options to man page 2011-02-19 20:56:20 -08:00
Ryan Dahl
e5a472229b Now working on v0.4.2 2011-02-19 19:06:10 -08:00
Ryan Dahl
e8aef84191 Bump version to v0.4.1 2011-02-19 18:45:34 -08:00
Ryan Dahl
c2a62951f6 TLS sockets should not be writable after 'end'
Closes GH-694.
2011-02-19 18:25:15 -08:00
Ryan Dahl
c72ae27be1 test-tls-securepair-server: don't shutdown stdout 2011-02-19 16:56:56 -08:00
isaacs
8b9dbdad27 Closes GH-687 Don't read fs read stream if not open 2011-02-19 16:38:21 -08:00
Brian White
1efac74958 Fix os.cpus() on cygwin 2011-02-19 15:14:07 -08:00
Ryan Dahl
1fce3f0ef8 Add startup memory script to benchmarks 2011-02-18 14:01:04 -08:00
Ryan Dahl
ebfc90b505 Remove test-http-eof-before-eom - wasn't testing anything important 2011-02-18 11:30:52 -08:00
Ryan Dahl
26e580bbc4 Use console.error in test-timers
In attempt to understand buildbot failures.
2011-02-18 11:20:45 -08:00
Tom Hughes
3313ff1d1b cmake: dtrace support. 2011-02-18 10:45:25 -08:00
Tom Hughes
9d49c93cb5 cmake: Add gdbjit and oprofile options. 2011-02-18 10:45:17 -08:00
Tom Hughes
de2686c3e1 cmake: cleanup. 2011-02-18 10:45:04 -08:00
Tom Hughes
8bedde464f cmake: Fix mac snow leopard build. 2011-02-18 10:44:58 -08:00
Tom Hughes
6a594fed96 cmake: set pre and post memcheck commands.
We need to clear out and re-create the tmp directory when running
valgrind just like for the normal test run.
2011-02-18 10:44:36 -08:00
isaacs
f8defa3e09 package.json main as indexed subdir
Closes GH-686.
2011-02-18 10:43:06 -08:00
Ryan Dahl
aac5cbe025 HTTP Agent sockets should not reconnect on error
Closes GH-684.
2011-02-18 10:40:09 -08:00
Ryan Dahl
9b0c7618c5 HTTP Agent should not die on evil server
Closes GH-680.
2011-02-18 00:42:07 -08:00
Matt Ranney
ab969bfaf8 Add failing test for broken HTTP responses with extra bytes.
For GH-680.
2011-02-18 00:08:05 -08:00
Ryan Dahl
15a6aa7500 Add more broken tests 2011-02-17 21:06:16 -08:00
Ryan Dahl
7e4f755073 Install node.d in the correct place 2011-02-17 11:07:19 -08:00
Bert Belder
25ce5016f4 Fix test runner bug on windows 2011-02-17 10:52:28 -08:00
Bert Belder
874321298b Make libev work on MinGW again 2011-02-17 10:47:04 -08:00
Bert Belder
a5e67ad9e7 Autodetect no-strict-aliasing, propagate toolchain option to SCons
BUG=v8:884
2011-02-17 10:46:38 -08:00
Ryan Dahl
7f78e5857f Move test-tls-throttle to pummel 2011-02-16 18:12:08 -08:00
Ryan Dahl
19b4c27ebf TLS: Make _cycle reentrant. 2011-02-16 18:10:53 -08:00
Ryan Dahl
89bfa419a5 Make test-http-curl-chunk-problem more portable
Use 'openssl sha1' instead of 'shasum'
2011-02-16 13:17:19 -08:00
Ryan Dahl
e0e52f930e Remove artificial timeout from test-https-large-response 2011-02-16 12:22:48 -08:00
Ryan Dahl
470ebe249f Upgrade libev to 4.4 2011-02-16 12:07:58 -08:00
Bert Belder
b1664daeb9 V8 Cygwin support 2011-02-16 12:04:44 -08:00
Ryan Dahl
550f73ae3e Upgrade V8 to 3.1.5 2011-02-16 10:38:49 -08:00
Bert Belder
3ef6433255 MinGW: OpenSSL support 2011-02-15 20:15:46 -08:00
Ryan Dahl
c365f56061 https was missing 'end' event sometimes
Closes GH-671.
2011-02-15 17:13:53 -08:00
Tj Holowaychuk
42a369620f Fixed null signal preservation
Closes GH-674.
2011-02-15 16:35:50 -08:00
Ryan Dahl
60ad3aa917 Disable test-tls-large-push, taking too long 2011-02-15 14:06:23 -08:00
Felix Geisendörfer
e56ee67e13 Refactor fs.open parameter handling
Improvements:
* Removes an unnecessary variable
* Avoids having two variables with the same name
* Avoids re-declaring an existing parameter
* Removes an unnecessary ternary operator
* Avoid an inline short-circuit expression for greater clarity.
2011-02-15 13:57:54 -08:00
Felix Geisendörfer
aabdd5d045 Correct fs.open API documentation
The fact that the mode parameter is optional for fs.open and
fs.openSync was not documented.
2011-02-15 13:57:41 -08:00
Felix Geisendörfer
29b0dc4ec8 Fix: fs.open callback did not fire
Problem: Omitting the mode parameter causes the provided callback
parameter to never fire. This was originally fixed in 6078c37b and
later broken in 5f2e9093.

Solution: Overwriting the value of a parameter also overwrites the
reference in the arguments object. This patch works arround this
fact by not touching the mode parameter until a reference to the
callback has been established.
2011-02-15 13:50:59 -08:00
Bert Belder
a293f90db4 Improve V8 support for Cygwin
Should re-enable crankshaft; can build w/ snapshot again.
2011-02-15 12:29:59 -08:00
Ryan Dahl
77ae87d367 default to port 80 for http.request 2011-02-15 12:08:26 -08:00
Ryan Dahl
ad7c2a8938 escape chars on man page 2011-02-14 18:37:43 -08:00
Ryan Dahl
daeb5c9e8f fix doc
thanks Toshihiro
2011-02-14 18:35:36 -08:00
Ryan Dahl
bd094103d7 Add script for running V8 benchmarks 2011-02-14 17:26:54 -08:00
Richard Rodger
b11d78b386 Fix for DNS fail in HTTP request
Closes GH-653.
2011-02-14 16:36:23 -08:00
isaacs
f07041e6cd Make the repl respect node_modules folders.
This is important so that in the future, this will work:

    $ cd ~/dev/js/some-project
    $ npm install redis
    $ node
    > require.resolve('redis')
    '/Users/isaacs/dev/js/some-project/node_modules/redis/index.js'
2011-02-14 13:43:22 -08:00
Tj Holowaychuk
fe838611f6 Fixed field merging with progressive fields on writeHead() 2011-02-14 13:40:31 -08:00
Ryan Dahl
c6712ced20 Add newline to platform-cygwin.cc 2011-02-14 09:36:28 -08:00
Ryan Dahl
5ceefec820 Add http client to v0.4 announcement 2011-02-14 09:36:08 -08:00
Ryan Dahl
485ce139fd Now working on v0.4.1 2011-02-14 09:36:02 -08:00
Ryan Dahl
eb155ea6f6 Bump version to v0.4.0 2011-02-10 02:40:11 -08:00
Tim Caswell
b09c5889be Add support for mutable/implicit headers for http.
This works for both ServerResponse and ClientRequest.
Adds three new methods as a couple properties to to OutgoingMessage objects.
Tests by Charlie Robbins.

Change-Id: Ib6f3829798e8f11dd2b6136e61df254f1564807e
2011-02-10 02:31:41 -08:00
Theo Schlossnagle
01a864a29d TLS: CRL support
Needs more tests.
2011-02-10 00:49:15 -08:00
Mikeal Rogers
634e7236f7 Add 'pipe' event 2011-02-09 23:04:35 -08:00
Bert Belder
583f2e5999 Follow-up fix for v8 cygwin build 2011-02-09 21:55:59 -08:00
Bert Belder
fd013d17a2 V8 cygwin support 2011-02-09 19:13:31 -08:00
Ryan Dahl
67e352e4b1 fix verifier.verify() docs
Thanks Sitelier. Closes GH-651.
2011-02-09 19:07:19 -08:00
Ryan Dahl
e9257b859d New DTrace probes from CA team 2011-02-09 18:50:26 -08:00
Ryan Dahl
778fb859c6 New keys, agent1-cert.pem was expired 2011-02-09 18:30:47 -08:00
Ryan Dahl
8cd07bb273 TLS: handle cert chains 2011-02-09 17:51:05 -08:00
Ryan Dahl
43bc1d7ec8 Edit module docs 2011-02-09 17:48:22 -08:00
isaacs
ff39d413a3 Document module loading 2011-02-09 17:34:21 -08:00
Bert Belder
35e32225d1 Workaround for V8 bug 884
See http://code.google.com/p/v8/issues/detail?id=884
2011-02-09 14:53:15 -08:00
isaacs
81b4d45354 Better assert in the node_modules tests 2011-02-09 14:35:08 -08:00
isaacs
46513483cd node_modules module lookup, +docs and test. 2011-02-09 14:24:22 -08:00
Ryan Dahl
dafd6d9137 TLS: Don't give up if you can't write 0 bytes 2011-02-09 13:27:23 -08:00
Ryan Dahl
a0702b54d1 Upgrade V8 to 3.1.2 2011-02-09 10:24:26 -08:00
Ryan Dahl
a48a075535 better debug messages in net and tls 2011-02-09 10:23:26 -08:00
Ryan Dahl
56ab929c55 Remove unused parameter from crypto::Handle*Error 2011-02-09 01:30:31 -08:00
Bert Belder
8d70294c31 Fix fs.realpathSync on windows 2011-02-08 21:24:30 -08:00
Bert Belder
36846f9b6b Windows: child process fixes 2011-02-08 21:21:39 -08:00
Ryan Dahl
519dc2c114 tls: split bio errors from ssl errors 2011-02-08 21:15:55 -08:00
isaacs
9bed5dcb2c Support caching for realpath, use in module load
This adds support for a cache object to be passed to the
fs.realpath and fs.realpathSync functions.  The Module loader keeps an
object around which caches the resulting realpaths that it looks up in
the process of loading modules.

This means that (at least as a result of loading modules) the same files
and folders are never lstat()ed more than once.  To reset the cache, set
require("module")._realpathCache to an empty object.  To disable the
caching behavior, set it to null.
2011-02-08 18:02:59 -08:00
Ryan Dahl
9de5043b50 tls: only emit data after 'secure' event 2011-02-08 17:29:33 -08:00
Bert Belder
38d8cd60ea Don't make unnecessary getcwd calls from path.resolve 2011-02-08 14:30:24 -08:00
Ryan Dahl
6b50a9f5f4 (won't) fix test-next-tick-ordering 2011-02-07 21:15:58 -08:00
Ryan Dahl
448e0f4394 tls fixes 2011-02-07 21:11:43 -08:00
Bert Belder
61af4207da Fix dns on windows 2011-02-07 15:30:17 -08:00
Ryan Dahl
3ec030535c stderr should be EventEmitter even if it doesn't emit anything 2011-02-07 15:14:21 -08:00
isaacs
2e6a263e29 Closes GH-609 Support array-ish args to Buffer ctor
Any array-ish thing (whether a Buffer, an Array, or just an object with
a numeric "length") is interpreted as a list of bytes.
2011-02-07 14:13:18 -08:00
isaacs
5f2e90934e Support octal strings for modes
This allows the various fs utilities and process.umask to be used in
ECMAScript 5 Strict Mode, where the octal literal format is verboten,
without requiring users to litter their code with a bunch of parseInt
calls.
2011-02-07 14:05:06 -08:00
Ryan Dahl
57fa247f53 Closes GH-645. Document tty.getWindowSize 2011-02-07 13:46:15 -08:00
Konstantin Käfer
9e101f2b01 UCS-2 support
Closes GH-644.
2011-02-07 13:35:06 -08:00
Ryan Dahl
bf8f4aa966 Impove fs.WatchFile doc 2011-02-07 13:11:03 -08:00
Russell Haering
e6ede31554 http: fix buffer writes to outgoing messages 2011-02-07 12:59:25 -08:00
Daniel Gröber
71a8a3b78c cmake fixes
Closes GH-640.
2011-02-07 12:52:20 -08:00
Ryan Dahl
a98d0717e8 Remove incorrect doc about node_modules 2011-02-07 12:50:05 -08:00
isaacs
da2f4b2dc4 support for package.json
This adds basic support for situations where there is a package.json
with a "main" field.  That "main" module is used as the code that is
loaded when the package folder is required.
2011-02-07 11:00:22 -08:00
koichik
45c0faf399 corrected small typos 2011-02-07 10:52:19 -08:00
Mikeal Rogers
2b03ba5917 http: agent takes options instead of host, port pair 2011-02-05 02:35:44 -08:00
Ryan Dahl
0da96cca59 typo 2011-02-04 23:05:25 -08:00
Ryan Dahl
30f24bb2df Now working on v0.4.0 2011-02-04 19:54:18 -08:00
Ryan Dahl
9493b7563b Bump version to v0.3.8 2011-02-04 19:35:43 -08:00
Ryan Dahl
4733d0b1f0 http: handle aborts 2011-02-04 18:07:00 -08:00
Ryan Dahl
c783aefb0f http-parser: Error on EOF errors 2011-02-04 18:07:00 -08:00
Ryan Dahl
e42c74e141 Upgrade http-parser 2011-02-04 18:03:26 -08:00
Bert Belder
f99fc29e62 Fix mingw build 2011-02-04 14:49:50 -08:00
Bert Belder
6329633a3e Windows: open files in binary mode 2011-02-04 14:43:41 -08:00
Ryan Dahl
aa95e5708f Expose errno with a string. 2011-02-04 14:41:51 -08:00
Ryan Dahl
1a7830a92a Fix debug flag in timers.js 2011-02-04 09:00:21 -08:00
Ryan Dahl
c10caca34c Style 2011-02-03 16:58:05 -08:00
isaacs
2f1f22ab26 module: define functions only once. 2011-02-03 14:23:28 -08:00
Bert Belder
8ee9c53c77 Fix problem with libev/select on windows.
Patch by Marc Lehmann.
This fix should be included in the next libev release.
2011-02-03 14:05:51 -08:00
Bert Belder
d8d627e2d4 Revert "Workaround for libev handle caching bug on windows"
This reverts commit 25d0e38048.
2011-02-03 14:05:40 -08:00
Ryan Dahl
bc23ec8d05 Add process.stderr stream 2011-02-03 14:03:44 -08:00
Ryan Dahl
f6e5b8986f Clean up 2011-02-03 12:28:20 -08:00
Ryan Dahl
97f7c06451 TLS: fix throttling
Re-enable test-https-large-response.js

Closes GH-614.
2011-02-03 12:20:19 -08:00
Ryan Dahl
3e58696c07 TLS: Simplify error handling 2011-02-02 15:39:03 -08:00
Ryan Dahl
41b4ec7952 TLS: flush buffer before destroy
Also disable test-https-large-response.js. Covered by
test/simple/test-tls-throttle.js
2011-02-02 15:34:21 -08:00
Ryan Dahl
e6f14d6df5 (suck, blow) -> (pull, push) 2011-02-02 14:51:53 -08:00
Ryan Dahl
ee092f62ca Upgrade V8 to 3.1.1 2011-02-02 11:44:25 -08:00
isaacs
f86ec1366f Closes GH-619 Make require.main be the main module 2011-02-02 11:18:34 -08:00
Ryan Dahl
807fca6803 TLS: Set ssl.receivedShutdown after each read
Closes GH-613.
2011-02-01 14:40:17 -08:00
Ryan Dahl
2ff593ad23 TLS: better error reporting at binding layer
Closes GH-612.
2011-02-01 14:14:50 -08:00
Jorge Chamorro Bieling
ff7fc093a1 Longer nexttick ordering test
Closes GH-604.
2011-02-01 10:23:03 -08:00
Joe Walnes
df6e497793 dgram: setMulticastTTL, setMulticastLoopback and addMembership.
These are options needed for real-world multicasting.

Implementation notes:
- POSIX only.
- IPv4 only (IPv6 multicast is a tricky beast).
- Didn't update tests, because it can't effectively be demonstrated on
  localhost only.
2011-02-01 10:16:48 -08:00
Ryan Dahl
3e5b568504 TLS: Add _pendingBytes() 2011-01-31 17:29:11 -08:00
Ryan Dahl
33e8e3d799 Add simpler failing tls throttle test 2011-01-31 16:38:05 -08:00
Ryan Dahl
45b30a879b tls: superficial clean up 2011-01-31 16:37:29 -08:00
Bert Belder
9526fef626 Workaround for V8 bug 884
See http://code.google.com/p/v8/issues/detail?id=884
2011-01-31 13:26:46 -08:00
Ryan Dahl
0634e3a8bc Upgrade V8 to 3.1.0 2011-01-31 13:19:50 -08:00
Ryan Dahl
c501785112 Make availability of UDP bindings more apparent 2011-01-31 11:20:05 -08:00
Ryan Dahl
9f3a20c76d net: Add hook for when writeQueue changes 2011-01-31 11:01:59 -08:00
Ryan Dahl
ef123600ce Add artificial timeout to broken test-https-large-response 2011-01-31 10:44:08 -08:00
Ryan Dahl
6ede26cb9c Add socket.bufferSize 2011-01-31 10:41:52 -08:00
Tim Caswell
845df3cd2e Slightly throttle https large body test 2011-01-28 14:35:20 -08:00
Ryan Dahl
fda70b8b90 getaddrinfo exists on windows 2011-01-28 13:40:41 -08:00
Ryan Dahl
43d818a19c Fix version 2011-01-28 13:09:01 -08:00
Ryan Dahl
192d2e0803 REPL: disable colors in windows for now 2011-01-28 12:58:19 -08:00
Bert Belder
88947dc4f0 Workaround for V8 bug 884
See http://code.google.com/p/v8/issues/detail?id=884
2011-01-28 12:53:09 -08:00
Ryan Dahl
7eaa956bae Upgrade V8 to 3.0.12 2011-01-28 01:57:00 -08:00
Ryan Dahl
97375c475e Now working on v0.3.8 2011-01-27 21:11:56 -08:00
Ryan Dahl
d8579c6afd Bump version to v0.3.7 2011-01-27 20:07:54 -08:00
Ryan Dahl
286389202f Fix pummel/text-exec 2011-01-27 20:07:53 -08:00
Ryan Dahl
b6c66f735b Revert "Use html5 spec stylesheet for docs"
This reverts commit 6dbf49110b.
2011-01-27 19:55:52 -08:00
Ryan Dahl
eb565e1ce2 Simplify website 2011-01-27 19:52:56 -08:00
Ryan Dahl
895968d8f8 Add test-https-large-response.js 2011-01-27 19:27:25 -08:00
Ryan Dahl
df5d5d6342 Fix option parsing in tls.connect() 2011-01-27 19:25:08 -08:00
Ryan Dahl
cb06abe1e5 Helpful error when child_process.exec hit maxBuffer 2011-01-27 17:45:17 -08:00
Ryan Dahl
1f041fe73e debugger: prevent crash when backtrace doesn't come back 2011-01-27 17:44:42 -08:00
Ryan Dahl
fbb74784b5 Remove more process.assert 2011-01-27 17:02:25 -08:00
Ryan Dahl
bfb6a67d60 Another fix for process.assert 2011-01-27 16:59:28 -08:00
Ryan Dahl
f71e4d8b43 Fix process.assert problem
Introduced in f9f0e5c75c
2011-01-27 16:55:54 -08:00
Ryan Dahl
f9f0e5c75c Pre-process out assert() 2011-01-27 16:38:49 -08:00
Ryan Dahl
6e53cf8b3f Fix links 2011-01-27 16:24:02 -08:00
David Trejo
3a05a6eaca newcomer resources in README
Closes GH-579.
2011-01-27 16:20:31 -08:00
Greg Hughes
1a5e513084 Fix style issues with ext_key_usage patch
Closes GH-586.
2011-01-27 16:16:22 -08:00
Ryan Dahl
4ea6916974 Correct process.kill doc
Thanks Kevin. Closes GH-518.
2011-01-27 14:37:45 -08:00
Ryan Dahl
97e13748fa Typos
Closes GH-557.
Closes GH-539.
2011-01-27 14:28:47 -08:00
Ryan Dahl
8f23583d10 A few spelling fixes.
Thanks Bjarki. Closes GH-561.
2011-01-27 14:24:10 -08:00
Ryan Dahl
3d4a0211b6 Fix arg order of fs.linkSync in docs
Thanks Pierre. Closes GH-571.
2011-01-27 14:22:17 -08:00
Greg Hughes
6c32e155d3 Add ext_key_usage to getPeerCertificate 2011-01-27 14:06:40 -08:00
isaacs
6cdeb3b3fd A module ID with a trailing slash must be a dir.
require('./foo/') should not try to load './foo.js'.  It should only
look for ./foo/index.js

Closes GH-588
2011-01-27 14:02:43 -08:00
Ali Farhadi
36ef5643c3 Fixing bug in http request default encoding. 2011-01-26 12:18:25 -08:00
Ali Farhadi
c70dd70301 Adding callback parameter to Socket's setTimeout method. 2011-01-26 12:13:03 -08:00
Ryan Dahl
129217a4e9 Increase timeout on test-repl to 5 seconds
Hopefully wont get failures on buildbot slaves.
2011-01-25 17:35:08 -08:00
Ali Farhadi
910a859b9c Adding test for many keep-alive connections 2011-01-25 17:20:25 -08:00
Ryan Dahl
5ad00f82c6 debugger: Don't crash when evaling buffer 2011-01-25 15:50:12 -08:00
Ryan Dahl
72bef516dc Revert "Preprocess out assert()"
This reverts commit 8bd7e4fad8.
2011-01-25 15:26:19 -08:00
Carter Allen
5ad93ab573 Fix tests when spaces are in path 2011-01-25 12:56:35 -08:00
Ryan Dahl
8bd7e4fad8 Preprocess out assert() 2011-01-25 12:53:44 -08:00
Ryan Dahl
39ff40e5a2 Use old http.Client
This is meant as a path for upgrading to the new http.request() API.
http.Client will be disappearing in the future.
2011-01-25 12:13:20 -08:00
Ryan Dahl
72dd8778b9 Fix undefined_reference_in_new_context 2011-01-24 22:40:06 -08:00
Daniel Ennis
52f93185c7 Adding support for require-like initialization of node,
so `node foo`
will load one of:
./foo.js
./foo.node
./foo/index.js
./foo/index.node

Test cases added.
Ensured no conflict with native names.
2011-01-24 21:33:30 -08:00
Ryan Dahl
4c5e570706 Upgrade V8 to 3.0.10 2011-01-24 20:55:18 -08:00
Bert Belder
07f3274ac4 Readline: fixes, more key bindings
- Made backward/forward more convenient
- More key bindings that windows users are used to
- Fix delete-word-right
- Duplicate code cleanup
2011-01-24 20:43:50 -08:00
isaacs
430a7f1bed Support pastes and meta-backspace 2011-01-24 20:42:52 -08:00
Bert Belder
f9fea12555 Fix windows build 2011-01-24 20:37:15 -08:00
Ryan Dahl
068b733583 Land Cantrill's DTrace patch
only works on solaris
2011-01-24 18:59:06 -08:00
Felix Geisendörfer
91cc2d8c4b Restructure src/node.js startup code
This patch introduces a logical structure and sequence for the
bootstrap code found src/node.js.
2011-01-24 14:52:25 -08:00
Ryan Dahl
cc5e9130bb fs.open should set FD_CLOEXEC 2011-01-24 11:57:21 -08:00
Ryan Dahl
9e976abad9 lint 2011-01-24 10:55:30 -08:00
Bert Belder
f263b29141 Windows: better net support 2011-01-24 10:35:41 -08:00
Bert Belder
25d0e38048 Workaround for libev handle caching bug on windows
The windows socket api uses handles, not fds. Libev caches the handle
associated with an fd, and uses this handle when updating the (also cached)
handle set that goes into select(). When an fd is closed and subsequently
re-used before the event loop returns to libev, libev fails to detect
properly that the handle changed. And even if it does, the cached handle of
the closed socket is overwritten by the new handle, so by the time libev
tries to update the select fdset it has forgotten which handle to remove
from it. This is solved by a simple hook ev_fd_closed that makes it clear
its caches before the fd is re-used.
2011-01-24 10:34:18 -08:00
Ryan Dahl
555184663a windows compat: undefined_reference_in_new_context test 2011-01-23 15:32:07 -08:00
Ali Farhadi
d81afcb3a6 Fixing bug in http request's end method. 2011-01-23 15:22:42 -08:00
Felix Geisendörfer
5a49f96505 Move commonjs module system into lib/module.js
This de-couples NativeModule from the module system and completes the
main objective of this refactoring.
2011-01-23 14:53:17 -08:00
Mikeal Rogers
8d37f80f4b Expose agent in http and https client. 2011-01-23 12:02:43 -08:00
Ryan Dahl
7892918353 Now working on v0.3.7 2011-01-21 18:26:05 -08:00
Ryan Dahl
bb3e71466e Bump version to v0.3.6 2011-01-21 18:18:37 -08:00
Ryan Dahl
6703a7f1e0 Add https docs to toc 2011-01-21 18:18:32 -08:00
Ryan Dahl
76afea90cf Fix test-http-exceptions
Agent: Each time an http req is sent to a socket, _cycle to try to dispatch
another. Problem became apparent in 4612b0 when we wait for connecting
sockets.
2011-01-21 17:49:01 -08:00
Ryan Dahl
4612b07604 Fix test-http-allow-req-after-204-res
Agent queue waits for connecting sockets.
2011-01-21 17:39:48 -08:00
Ryan Dahl
7dfbccf9bd Add test-https-agent 2011-01-21 15:56:27 -08:00
Ryan Dahl
68f2aa2715 http: agent should cycle on close 2011-01-21 14:55:29 -08:00
isaacs
49275524a5 Fix for meta keys in a weird iTerm state. 2011-01-21 13:51:59 -08:00
isaacs
d40af91b30 Windows line endings. s/\r//g 2011-01-21 13:51:49 -08:00
Bert Belder
8da7202d0b Fix meta+character keys on mac 2011-01-21 13:51:19 -08:00
Ryan Dahl
b9574b995f Expose http.getAgent 2011-01-21 13:47:27 -08:00
Ryan Dahl
db8736ad93 Add https.get() 2011-01-21 13:21:01 -08:00
Ryan Dahl
e65f6b4ce1 Initial pass at https client 2011-01-21 13:13:02 -08:00
Ryan Dahl
86e687086b waf: display oprofile and gdbjit options for all platforms
was breaking mac
2011-01-20 19:07:19 -08:00
Ryan Dahl
6eca6b1ec0 Merge branch 'http_agent' 2011-01-20 18:38:13 -08:00
Ryan Dahl
a86747603c Fix test-http-upload-timeout
Cannot just close the connection or client will error.
2011-01-20 18:24:00 -08:00
Ryan Dahl
7a16e2a2a0 test-http-client-reconnect-bug: hang up should be error. 2011-01-20 18:19:30 -08:00
Ryan Dahl
0866ecaf3f ... 2011-01-20 18:10:15 -08:00
Ryan Dahl
032f80efea Docs for new http API 2011-01-20 18:10:15 -08:00
Ryan Dahl
f465949516 hacky work around socket hangups on http requests 2011-01-20 18:10:15 -08:00
Ryan Dahl
d89454e5d4 Backport client 'upgrade' events 2011-01-20 18:10:15 -08:00
Ryan Dahl
4125822bed all errors go to req object 2011-01-20 18:10:15 -08:00
Ryan Dahl
105c35b9fd http.Client shims 2011-01-20 18:10:15 -08:00
Ryan Dahl
e576d4ec79 Add parser to agent 2011-01-20 18:10:15 -08:00
Ryan Dahl
60aea96f84 first pass at http refactor for TLS 2011-01-20 18:10:15 -08:00
Ryan Dahl
ae30af44cf Disable gdbjit by default 2011-01-20 18:04:09 -08:00
Bert Belder
a763a4f4d9 Fix memory corruption bug on Windows 2011-01-20 01:41:16 +01:00
Bert Belder
8ca0b9a3c5 Fix ev_async misuse in node_child_process_win32.cc 2011-01-20 01:40:55 +01:00
kmillikin@chromium.org
7c2869046e Fix an assertion failure in the full code generator.
We hit an assertion failure when we tried to record the AST ID of
the (shared) .arguments variable proxy more than once.  This was hit
when we had multiple calls to the same parameter in a function that
used the arguments object.  The fix is to not visit the subexpressions
of the (shared) property access expression.

BUG=1060

Review URL: http://codereview.chromium.org/6368007

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@6404 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-01-20 01:39:32 +01:00
Ryan Dahl
ba80d4d8a9 Transfer data gathering responsibility to readline
Fixes non-raw REPL/Debugger on Posix.
2011-01-19 11:46:16 -08:00
Ryan Dahl
d4127717ac Fix tab on posix tty 2011-01-19 11:33:42 -08:00
Ryan Dahl
6e9f746a46 wscript: style 2011-01-19 11:18:12 -08:00
Ryan Dahl
5895df4d0e Compile gdbjit in by default on linux 2011-01-19 11:17:25 -08:00
Bert Belder
a61066ea1b Workaround for V8 bug 884
See http://code.google.com/p/v8/issues/detail?id=884
2011-01-19 11:06:49 -08:00
Ryan Dahl
b8f006ef72 Upgrade V8 to 3.0.9 2011-01-19 11:06:13 -08:00
Bert Belder
e6e6e87463 Windows: fix window size getter bug 2011-01-18 23:22:38 -08:00
Bert Belder
f0bf325495 Update TODO.win32 2011-01-18 23:22:38 -08:00
Bert Belder
4475b76535 Readline: use symbolic key names instead of ascii control codes 2011-01-18 23:22:38 -08:00
Bert Belder
8c9b2d1066 Readline: use tty methods instead of control sequences 2011-01-18 23:22:38 -08:00
Bert Belder
0b5bf70bff Use tty.ReadStream and tty.WriteStream for stdio when appropriate 2011-01-18 23:22:38 -08:00
Bert Belder
87d898929f Implement tty.ReadStream and tty.WriteStream 2011-01-18 23:22:38 -08:00
Bert Belder
4fddca09f1 New stdio functions to aid new readline interface 2011-01-18 23:22:38 -08:00
Bert Belder
b0eed65584 Windows: watcher for tty events 2011-01-18 23:22:38 -08:00
Ryan Dahl
4f8dd28f7e wscript chooses win32 source files, not cpp 2011-01-18 23:22:38 -08:00
Ryan Dahl
cb14236bb4 Use common.PORT not 8000 2011-01-18 22:27:12 -08:00
Ryan Dahl
39535d74df move test-exec to pummel - too slow 2011-01-18 22:25:38 -08:00
Alexis Sellier
66b418d6f3 make 'readyState' available to CryptoStream 2011-01-18 22:22:50 -08:00
Ryan Dahl
2f6cb66009 Add setEncoding to CryptoStream 2011-01-18 18:30:12 -08:00
Ryan Dahl
4d0416caf6 Add setNoDelay to cryptostream 2011-01-18 17:56:52 -08:00
Ryan Dahl
b22b5e341b listen/bind errors should close net.Server 2011-01-18 16:22:43 -08:00
Ryan Dahl
2ec4cd5525 factor linklist code into own file 2011-01-18 14:26:32 -08:00
Bert Belder
b8879d64dd Remove completed TODO.win32 items 2011-01-18 04:58:33 +01:00
Bert Belder
6ad629895d Make child_process.kill always work on windows 2011-01-18 04:58:32 +01:00
Bert Belder
bb3bf091d4 Fix several child process bugs on windows 2011-01-18 04:58:32 +01:00
Bert Belder
5087c62f18 Fix detection of socket errors 2011-01-18 04:58:31 +01:00
Bert Belder
2ce0961de1 Improve error reporting on windows 2011-01-18 04:58:30 +01:00
Bert Belder
0eb4c2157d Define winsock error numbers 2011-01-18 04:58:30 +01:00
Bert Belder
c99962e4cd Misc. cleanups
casts, unused vars, function ordering, /* within comment, etc.
2011-01-18 04:58:29 +01:00
Bert Belder
e0f47be9d0 Clean up the way windows headers are included
Plus make inclusion order a little more consistent in general
2011-01-18 04:58:11 +01:00
Bert Belder
43d75952ff Windows: get rid of most NO_IMPL related macros 2011-01-18 04:49:54 +01:00
Bert Belder
dc99aa0c8c Windows: implement missing stdio methods 2011-01-18 04:49:54 +01:00
Bert Belder
b70f8aec84 Workaround for V8 bug 884
See http://code.google.com/p/v8/issues/detail?id=884
2011-01-18 04:49:42 +01:00
Ryan Dahl
86bf3309bf docs: style 2011-01-17 13:35:30 -08:00
Ryan Dahl
a51063c13c docs: Add note about global scope 2011-01-17 13:35:11 -08:00
Bert Belder
595509bb4c Fix v8 build on windows
reported to v8 in http://codereview.chromium.org/6056006/
2011-01-17 12:28:48 -08:00
Ryan Dahl
cf2e4f44af Upgrade V8 to 3.0.8 2011-01-17 11:32:56 -08:00
Ryan Dahl
082a4b6033 Now working on v0.3.6 2011-01-16 15:28:01 -08:00
Ryan Dahl
b622bc6305 Bump version to v0.3.5 2011-01-16 15:12:28 -08:00
Felix Geisendörfer
0263f01475 Fix test-require-cache-without-stat.js
This path adds an additional cache to the module system for caching the
location of previously required modules. Since it is embedded in the
loop that iterates over all require.paths, this patch also handles the
case where require.paths is being modified.

The patch also cleans up some code around it.

See: https://groups.google.com/forum/#!topic/nodejs-dev/QGGlrvLDHVs
2011-01-16 14:52:55 -08:00
Felix Geisendörfer
f39fdf2610 Isolate native module system again
See: 2e5dfafcb0 (commitcomment-239719)
2011-01-16 14:51:21 -08:00
Ryan Dahl
c3b0d133aa Add built-in module loading to test-require-cache-without-stat 2011-01-16 14:34:39 -08:00
Ryan Dahl
f35773ad07 Add broken test for require cache working
require is caching the compiled code but still stating the filenames.
https://groups.google.com/d/topic/nodejs-dev/QGGlrvLDHVs/discussion
2011-01-16 01:21:40 -08:00
Ryan Dahl
d9087c10ad style 2011-01-16 00:33:16 -08:00
Ryan Dahl
9bcfc0745c Revert "Implement os.isWindows"
This reverts commit 9e31e0837e.

Use process.platform == 'win32'
2011-01-13 20:32:36 -08:00
Ryan Dahl
496be457b6 Allow third party hooks before main module load
Just put a file lib/_third_party_main.js into the build directory and take
it from there.
2011-01-13 16:30:29 -08:00
Ryan Dahl
860e7a7a5f debugger: don't hang on ^d and ^c 2011-01-13 16:04:33 -08:00
Ryan Dahl
4fa712c48f debugger: error out without script
TODO:

debug> run script.js
2011-01-13 15:29:53 -08:00
Ryan Dahl
53f29d86c0 debugger: add uncaughtException handler to kill child 2011-01-13 15:18:20 -08:00
Ryan Dahl
0fa3f2febd debugger: Correctly eval arrays and numbers 2011-01-13 13:59:35 -08:00
Ryan Dahl
533797a607 debugger: full scope evals 2011-01-13 13:32:16 -08:00
Ryan Dahl
d87ab5450b debugger: Better backtraces 2011-01-13 13:32:16 -08:00
Ryan Dahl
7df8a05129 debugger: primative object inspection 2011-01-13 13:32:16 -08:00
Ryan Dahl
cb71a7dab3 debugger: take help message from commands 2011-01-13 13:32:16 -08:00
Ryan Dahl
29f48d48e5 A few more list clean ups 2011-01-13 02:22:09 -08:00
Ryan Dahl
09994438e5 Expose link-list from timers.js; add tests 2011-01-13 02:10:09 -08:00
Ryan Dahl
4e1e6a2d15 debugger: Don't break on handle === 0 2011-01-12 16:43:05 -08:00
Felix Geisendörfer
f5fbb707b2 Fix NODE_PATH, was broken after cleanup 2011-01-12 16:07:36 -08:00
Felix Geisendörfer
f61277ecb0 Always init module paths
The previous cleanup patch broke module loading in the the REPL by
not initializing require.paths.
2011-01-12 16:07:07 -08:00
Felix Geisendörfer
2e5dfafcb0 Cleanup node module system code 2011-01-12 13:32:06 -08:00
Ryan Dahl
5f5201db2f Fix test-net-connect-buffer
Change to end() behavior in 33c339 was breaking it. end() should wait for
connection before dumping. Changed test-net-connect-timeout to use destroy()
instead.
2011-01-12 13:29:45 -08:00
Ryan Dahl
5f795efd4e net: Timeouts should work before DNS resolution 2011-01-12 12:59:58 -08:00
Ryan Dahl
33c33949b2 Add test for connection timeouts
Also make socket.end() destroy connection if still trying to connect.
Previously was ignoring.
2011-01-12 10:57:03 -08:00
Ryan Dahl
72589b60ad debugger: Only display basename of scripts 2011-01-12 10:33:10 -08:00
Ryan Dahl
1b63bd16ed tab completion for commands in debugger 2011-01-12 10:32:48 -08:00
Ryan Dahl
fc634cd92c Upgrade c-ares to 1.7.4 2011-01-11 18:19:22 -08:00
Ryan Dahl
86160a8807 NODE_DEBUG=timer instead of bitflags 2011-01-11 16:53:05 -08:00
Ryan Dahl
82e9da9fb7 Allow one extra ms in timer diff
Fixes sporadic test-next-tick-ordering.js failures
2011-01-11 16:51:09 -08:00
Ryan Dahl
7c0f453b7c Add delay into test-debugger-client 2011-01-11 16:30:01 -08:00
Ryan Dahl
8e461673c4 Put a little delay into test-tls-securepair-client.js
Avoids race. openssl s_server is a terrible program.
2011-01-11 15:37:58 -08:00
Bert Belder
b9540c28e9 Libev windows fixes 2011-01-11 14:48:07 -08:00
Ryan Dahl
6dbf49110b Use html5 spec stylesheet for docs 2011-01-11 14:32:42 -08:00
Ryan Dahl
464f5d4e13 Merge branch 'vanilla-libeio'
Conflicts:
	deps/libeio/config.h.in
2011-01-11 14:13:06 -08:00
Ryan Dahl
b8d63c10cd Upgrade libeio 2011-01-11 14:09:17 -08:00
isaacs
435ece5058 child_process: Support setting uid/gid by name 2011-01-11 13:54:51 -08:00
Ryan Dahl
b92329667f Fix spelling mistakes 2011-01-11 10:18:46 -08:00
isaacs
6f5d95de6d child_process: Add gid/uid flags to spawn config
This is mostly working, but not completely ideal for two reasons.

1. Rather than emitting an error on the ChildProcess object when the
setgid/setuid fails, it is simply printing the error to stderr and
exiting.  The same happens with the cwd, so that's not completely
terrible.

2. I don't have a good test for this.  It fails with an EPERM if you try
to change the uid or gid as a non-root user.
2011-01-11 10:02:58 -08:00
Ryan Dahl
b7419dfaad Upgrade libev to 4.3 2011-01-11 08:47:18 -08:00
Bert Belder
01148265cb Improve path.resolve documentation 2011-01-10 18:05:15 -08:00
Ryan Dahl
320a56b89d Bump size of bench histogram to 100ms 2011-01-10 18:00:21 -08:00
Ryan Dahl
b9cfd9527a getWindowSize/setWindowSize 2011-01-10 17:25:48 -08:00
Ryan Dahl
63bd237892 typo setuid -> setsid 2011-01-10 17:15:17 -08:00
Ryan Dahl
907e569980 Fix expired keys 2011-01-10 16:30:26 -08:00
Ryan Dahl
1f38046b51 tty.open() returns stream instead of slaveFD
Also is run in its own session.
2011-01-10 16:25:15 -08:00
Ryan Dahl
202dd8387f Add setsid option to child_process 2011-01-10 16:24:49 -08:00
Ryan Dahl
9da75f39d9 Print error when EventEmitters get too many listeners 2011-01-10 13:48:35 -08:00
Ryan Dahl
e1f4b3f009 debugger: implement 'list' 2011-01-08 19:10:17 -08:00
Ryan Dahl
5342e3e925 expose module wrapper to native modules 2011-01-08 19:09:33 -08:00
Ryan Dahl
5580907c58 debugger: fix 'scripts' command
path.split() no longer available
2011-01-08 18:20:39 -08:00
Ryan Dahl
318b1a0a03 Now working on v0.3.5-pre 2011-01-08 16:19:07 -08:00
Ryan Dahl
73f53e12e4 Bump version to v0.3.4 2011-01-08 15:46:07 -08:00
Mihai Călin Bazon
0853730c35 realpath files during module load 2011-01-07 13:00:19 -08:00
Ryan Dahl
2e76cd382f TLS: Forward errors to cleartext
But only after control has been inverted.
2011-01-07 10:58:13 -08:00
Ryan Dahl
08bec7ab0a Remove debugger statement from http_simple.js
results in slow bench
2011-01-06 18:07:50 -08:00
Ryan Dahl
5a05992155 Lint 2011-01-06 16:06:27 -08:00
Bert Belder
1ac133ea6f Replace string magic + path.join by path.resolve
Because path.resolve is more elegant and windows-safe.
2011-01-06 15:39:51 -08:00
Bert Belder
dea2331377 Rework fs.realpath, primordal windows compatibility 2011-01-06 15:38:50 -08:00
Bert Belder
7c731ec9dd Path.resolve, path module windows compatibility
Removes path.normalizeArray() and path.split()
2011-01-06 15:36:25 -08:00
isaacs
48334dc0b1 Fix regression introduced in fe804d9b
It breaks argv[0] on posix systems, and makes it so that npm can't
determine whether node was run from an explicit location, or via "node",
so the configs default improperly.

If on windows, don't do this behavior.  On posix, go back to the old
behavior.
2011-01-06 14:39:06 -08:00
Ryan Dahl
b6dafc1a47 Allow for two streams in REPL
Towards windows compatibility.
2011-01-06 13:42:32 -08:00
Ryan Dahl
22561dfbcf Joyent link goes to no.de 2011-01-06 11:05:19 -08:00
Ryan Dahl
3770462ee3 Fix process.platform 2011-01-05 19:05:59 -08:00
Ryan Dahl
bb7bf58cc7 Update TODO items 2011-01-05 11:59:04 -08:00
Ryan Dahl
4e108ef9b6 Remove legacy TLS api from docs 2011-01-05 11:55:24 -08:00
Ryan Dahl
b62152bc84 Rename net.Stream to net.Socket 2011-01-05 11:53:56 -08:00
Bert Belder
af15b4e45a Remove path module dependency from url module
Now the path module can be adapted to support windows paths without breaking
the url module.  It also allows the undocumented keepBlanks flag to be
removed from path.join and path.normalizeArray.
2011-01-05 11:27:22 -08:00
Bert Belder
9ddfcfecca Remove keepBlanks flag from path functions 2011-01-05 11:17:38 -08:00
Bert Belder
9e31e0837e Implement os.isWindows 2011-01-04 18:38:58 -08:00
Ryan Dahl
468042fc84 Add C++ Buffer migration tips 2011-01-04 17:23:48 -08:00
Bert Belder
fe6f363837 Revert "realpath files during module load"
This reverts commit 131546e733.

Doesn't work on windows, coming back soon.
2011-01-04 17:04:00 -08:00
Bert Belder
b7b0c92ac1 Don't attempt to capture SIGUSR1 2011-01-05 00:45:01 +01:00
Bert Belder
3c330b05b1 Merge branch 'master' of git://github.com/ry/node
Conflicts:
	src/node.cc
	src/node.js
2011-01-05 00:41:59 +01:00
Mihai Călin Bazon
131546e733 realpath files during module load 2011-01-04 12:24:17 -08:00
Ryan Dahl
cda4d56bcf Implement WriteStream.destroySoon 2011-01-04 11:39:12 -08:00
Ryan Dahl
bc1d758408 net.js: Check that readWatcher exists before pause, resume 2011-01-04 11:25:36 -08:00
Ryan Dahl
2957382991 Implement new stream method, destroySoon
Still missing on fs.WriteStream
2011-01-04 11:22:19 -08:00
Ryan Dahl
73f4ec51fd hack for ending https connections 2011-01-04 10:36:05 -08:00
Ryan Dahl
94f8368cf9 First pass at new https server 2011-01-03 15:51:05 -08:00
Ryan Dahl
e4dd5cd6fd NODE_DEBUG uses strings instead of bitflags 2011-01-03 15:41:58 -08:00
Ryan Dahl
d040f1d19d debugger: use correct handle handle 2011-01-03 13:21:28 -08:00
Ryan Dahl
282cce1ea5 debugger: don't display whole path of scripts 2011-01-03 12:58:19 -08:00
Ryan Dahl
6593a96373 Merge branch 'debugger' 2011-01-03 10:27:16 -08:00
Ryan Dahl
2b5b128cba Now working on v0.3.4-pre 2011-01-02 18:57:22 -08:00
Ryan Dahl
57544ba1c5 Bump version to v0.3.3 2011-01-02 18:33:49 -08:00
Ryan Dahl
feb77eab65 Fix REPL for named functions
add some tests.
2011-01-02 18:27:14 -08:00
Bert Belder
c3ffbf219c Fix the OS module for win32 2011-01-02 23:44:43 +01:00
Bert Belder
33118df8f9 Merge remote branch 'origin/master'
Conflicts:
	src/node_net.cc
	src/node_os.cc
2011-01-02 22:57:32 +01:00
Ryan Dahl
b5637170b1 Fix openssl version check 2011-01-02 12:37:27 -08:00
Ryan Dahl
7e831bfba1 Disable TLS tests when node doesn't have OpenSSL. 2011-01-02 01:54:19 -08:00
Ryan Dahl
cd1ec27268 Add openssl version to process.versions 2011-01-02 01:44:42 -08:00
Ryan Dahl
1345103c3a Fix typos 2011-01-02 01:13:27 -08:00
Ryan Dahl
2e3e95ee89 add process.stdin 2011-01-01 21:54:46 -08:00
Ryan Dahl
c82fe30ca1 repl.js style 2011-01-01 21:41:07 -08:00
Ryan Dahl
29626d8731 Syntax error hack for modules. 2011-01-01 21:14:24 -08:00
Ryan Dahl
8b352bdc5d Add '{a:1}' to REPL tests 2011-01-01 21:14:06 -08:00
Ryan Dahl
00974df3e5 Allow for evaling statements in REPL too 2011-01-01 21:05:23 -08:00
Ryan Dahl
b45698e676 Improve how REPL commands are evaled
Before:
> {a: 1}
1
> (function() {
...   // foo
...   return 1;
... })();
...

Now:
> {a: 1}
{ a : 1 }
> (function() {
...   // foo
...   return 1;
... })();
1
>
2011-01-01 17:54:48 -08:00
Ryan Dahl
ce5ddacaf4 Fix solaris build
Stub out new platform functions.
2011-01-01 17:43:59 -08:00
Ryan Dahl
8f5f213a6f Revert "Add optional filters to stream.pipe()"
This reverts commit 24aded078f.
2011-01-01 16:41:39 -08:00
Ryan Dahl
1c7cd4aac3 Make syntax error display optional
Fixes GH-543
2011-01-01 16:38:31 -08:00
Ryan Dahl
40f29dd48a Lint node_script.cc 2011-01-01 13:41:04 -08:00
Ryan Dahl
5b81897cf6 Update links for v0.2.6 on website 2010-12-30 21:07:42 -08:00
Sami Samhuri
e5a47c8ce1 use util.inspect to format objects and arrays printed to the console 2010-12-30 19:14:30 -08:00
Daniel C
ca8cc71bd0 EventEmitter.prototype.once should "return this;" 2010-12-30 18:58:43 -08:00
Ryan Dahl
916f567d23 debugger: a little bit of doc 2010-12-30 18:50:10 -08:00
Ryan Dahl
af6662d5e5 debugger: Prompt before quitting 2010-12-30 18:50:07 -08:00
Ryan Dahl
7b9a2f29b4 debugger: Don't prompt until child is killed 2010-12-30 18:07:19 -08:00
Ryan Dahl
aea568b04a Fix some errors in debugger tests 2010-12-30 17:53:53 -08:00
Ryan Dahl
294bcb33e6 debugger: Fix some parser issues
Wouldn't handle events if it got backed up.
2010-12-30 17:33:07 -08:00
Ryan Dahl
62e0ca05a6 debugger: Disable/Enable raw mode for child 2010-12-30 15:46:47 -08:00
Ryan Dahl
0946474b5c debugger: Clean ups, bug fixes 2010-12-30 13:25:49 -08:00
Ryan Dahl
866201bd74 debugger: add 'kill' command 2010-12-30 12:35:13 -08:00
Ryan Dahl
a3c4e17c2a debugger: repeat command functionality 2010-12-30 11:54:49 -08:00
Ryan Dahl
074af67dd3 debugger: don't display node's internal scripts 2010-12-30 11:53:55 -08:00
Ryan Dahl
d4859a55bc Wrap up debugger in one class
just for better readablity
2010-12-30 11:17:12 -08:00
Ryan Dahl
109f845e49 debugger: style 2010-12-30 10:34:33 -08:00
Ryan Dahl
9244a64b59 debugger: Print error if executing command that requires being connected 2010-12-30 10:31:36 -08:00
Ryan Dahl
2a7e7b1c46 start debug agent on SIGUSR1 2010-12-30 10:20:21 -08:00
Ryan Dahl
481329ee7c debugger: clean up 2010-12-30 10:18:25 -08:00
Ryan Dahl
f484cbf4c7 Debugger: better maintance of script list 2010-12-30 10:02:42 -08:00
Ryan Dahl
bb400d5697 debugger: Work towards interactive restart 2010-12-30 01:35:20 -08:00
Ryan Dahl
e33d0de129 debugger: Clean up child 2010-12-30 01:35:13 -08:00
Ryan Dahl
90e55c3357 Rather have the debugger be parent process 2010-12-30 01:35:13 -08:00
Ryan Dahl
50c1c1e12d add 'info breakpoints' 2010-12-30 01:35:12 -08:00
Ryan Dahl
74cc021ec2 highlight current script 2010-12-30 01:35:12 -08:00
Ryan Dahl
080daf9ddd debugger: 'scripts' command was conflicting with 's' 2010-12-30 01:35:12 -08:00
Ryan Dahl
0adc6b29bd Start on frame zero - don't do extra break 2010-12-30 01:35:12 -08:00
Ryan Dahl
0c928b124c debugger: Clean up a few commands 2010-12-30 01:35:12 -08:00
Ryan Dahl
8874c51d04 Disable OPOST
Helps when sharing a tty with non-raw mode processes
2010-12-30 01:35:12 -08:00
Ryan Dahl
3be4f097a3 Debugger: Fix some output 2010-12-30 01:35:12 -08:00
Ryan Dahl
b5aed43f04 Add better breakpoint text 2010-12-30 01:35:12 -08:00
Ryan Dahl
0dcbe3f74a Fork out to debugger on debugger statements
Also implement continue in Client.
2010-12-30 01:35:12 -08:00
Ryan Dahl
4e81cf7def Debugger client emits ready after recving initial res 2010-12-30 01:35:11 -08:00
Ryan Dahl
a8417c128e Add more debugger tests 2010-12-30 01:35:11 -08:00
Ryan Dahl
8e96b8ab9b keep track of current frame. eval works for global scope 2010-12-30 01:35:11 -08:00
Ryan Dahl
797aa97e19 Fix test-debugger-client 2010-12-30 01:35:11 -08:00
Ryan Dahl
8d82ec2130 Add beginning of build-in debugger
+ test-debugger-client (which is currently broken)
2010-12-30 01:35:11 -08:00
Ryan Dahl
0df804b9e7 start debug agent on SIGUSR1 2010-12-30 01:35:10 -08:00
Ryan Dahl
e3ce73a214 Add ability to ask question from readline 2010-12-30 01:35:01 -08:00
Tom Hughes
54b1f8028a Free (ref-counted) private key. 2010-12-24 23:50:33 -08:00
Brian White
8275d7cd34 Fix Cygwin compatibility in the os module 2010-12-23 09:52:04 -08:00
Kai Chen
b2fd88ef7a correct some inline links in api document 2010-12-22 19:49:04 -08:00
Tom Hughes
ae8262a176 cmake: Add toolchain file for cross-compiling. 2010-12-22 16:12:49 -08:00
Tom Hughes
e03fae1447 cmake: Fix OpenSSL detection and node crypto compilation. 2010-12-22 16:12:39 -08:00
Daniel Gröber
1f7026e2a0 cmake: add -lutil 2010-12-22 16:12:18 -08:00
Brian White
d75c338dd6 Add more functionality to the os module 2010-12-22 11:01:25 -08:00
Tom Hughes
0d58353d66 Don't access buffer data before initializing it.
Prevents valgrind from complaining and still tests that buffer data is
treated as unsigned.
2010-12-22 10:33:46 -08:00
Tom Hughes
b38f4712c4 Fix memory leak in node_crypto.cc.
Both HexDecode and unbase64 allocate buffers, which weren't being freed.
2010-12-22 10:32:20 -08:00
Tom Hughes
4b555091e4 Fix memory corruption with unnamed AF_UNIX sockets.
AF_UNIX sockets can have a pathname, be unnamed, or abstract (Linux
only). If an unnamed socket is returned by getsockname, getpeername, or
accept, sun_path should not be inspected.
2010-12-22 10:29:28 -08:00
Ryan Dahl
d02131d206 Add 'make test-valgrind' 2010-12-22 10:24:47 -08:00
Ryan Dahl
4227e9d79d process.kill coerces args to integers 2010-12-21 15:41:22 -08:00
Oleg Slobodskoi
23cf938e4f fix assert.throws 2010-12-21 12:41:57 -08:00
Ryan Dahl
d793fcaabd Add toolchain=gcc to V8 build for Sun 2010-12-21 12:02:51 -08:00
Theo Schlossnagle
b202483e47 The following error can be thrown from accept on ECONNABORT. Instead, it should be ignored.
net:1100
        if (e.errno != EMFILE) throw e;
                               ^
Error: ECONNABORTED, Software caused connection abort
    at IOWatcher.callback (net:1098:24)
    at node.js:773:9
2010-12-21 10:46:58 -08:00
Ryan Dahl
1a894b39b3 Upgrade V8 to 3.0.4 2010-12-21 10:24:08 -08:00
Bert Belder
86518c3b11 Port GetHostName 2010-12-21 00:17:12 +01:00
Bert Belder
2d8ab90613 Revert "Performance-killing bug workaround for V8 on mingw"
This reverts commit 9a9edb0e8e.
2010-12-20 23:52:38 +01:00
Bert Belder
0b76321308 Update TODO.win32 2010-12-20 23:51:33 +01:00
Bert Belder
a6f2082b33 Fixes to child process 2010-12-20 23:51:32 +01:00
Bert Belder
d1bf9cf1f8 After building overwrite existing ./node(_g)?.exe 2010-12-20 23:51:32 +01:00
Bert Belder
0a2f1cb334 Child processes 2010-12-20 23:51:31 +01:00
Bert Belder
0b96c5bc3b Make using winsock extension functions possible 2010-12-20 23:51:30 +01:00
Bert Belder
2655269911 Make select work on >64 FDs on windows 2010-12-20 23:51:30 +01:00
Bert Belder
bd62203d13 Support for non-overlapped sockets
By default windows creates sockets with the WSA_FLAG_OVERLAPPED flag set.
Because child processes don't expect to have overlapped stdio (it never happens)
it won't work with them.
2010-12-20 23:51:29 +01:00
Bert Belder
d66cf5f32c Work around intermittent mkdir failures in testcfg.py 2010-12-20 23:51:28 +01:00
Bert Belder
fe804d9bc7 _Partial_ backslash support in node.js argv directory munging
Doesn't do it when node is started from another drive using a drive-relative path.
E.g:
  d:
  cd nodejs
  c:
  d:node.exe d:test.js
2010-12-20 23:51:27 +01:00
Bert Belder
9be07f7fe1 _Partial_ fix for backslash path separator support in path.js
Needs review & tests
2010-12-20 23:51:27 +01:00
Bert Belder
ad41e778b4 Port socketerror 2010-12-20 23:51:26 +01:00
Bert Belder
dd3308851d Fix connect bug 2010-12-20 23:51:25 +01:00
Bert Belder
4a2cb07808 Fix whitespace errors introduced by porting efforts 2010-12-20 23:51:25 +01:00
Bert Belder
a6aca21ced Updating todo.WIN32 2010-12-20 23:51:24 +01:00
Bert Belder
6d266219cc Add more stuff to TODO.win32 2010-12-20 23:51:23 +01:00
Bert Belder
e047ec340d Update TODO.win32 2010-12-20 23:51:22 +01:00
Bert Belder
4eea3e45bd make test somewhat works 2010-12-20 23:51:21 +01:00
Bert Belder
3c3d1d31c5 Better way of getting rid of symlinks
Windows, especially msysgit, doesn't like 'em
2010-12-20 23:51:21 +01:00
Bert Belder
e85733a80b Update TODO.w32 2010-12-20 23:51:20 +01:00
Bert Belder
46dc393ff1 node_net: IsIP and CreateErrnoException just work 2010-12-20 23:51:19 +01:00
Bert Belder
a807ac6660 Bugfixes, more consistency in node_net error handling 2010-12-20 23:51:18 +01:00
Bert Belder
2d39e1341c Make node_net Connect work 2010-12-20 23:51:18 +01:00
Bert Belder
cecc351303 Make node_net Shutdown work on windows 2010-12-20 23:51:17 +01:00
Bert Belder
0580f9a9bf Add todo file for windows port 2010-12-20 23:51:16 +01:00
Bert Belder
bea5e6eff6 Re-enable stat watchers on windows
This reverts commit b8a99f94167a25f63ae096d9d5e2cc9cf70cecef.
2010-12-20 23:51:16 +01:00
Bert Belder
967b7b0d8c Libeio should use correct stat/fstat as well 2010-12-20 23:51:15 +01:00
Bert Belder
f48c36f74f Use unicode and bigfile aware stat/fstat 2010-12-20 23:51:14 +01:00
Bert Belder
1361e87e80 Fix error reporting and EAGAIN handling bug in net Write
Clarify some comments as well
2010-12-20 23:51:14 +01:00
Bert Belder
b0f048e970 Remove stray file 2010-12-20 23:51:13 +01:00
Bert Belder
03a74efb16 Don't break the linux build 2010-12-20 23:51:12 +01:00
Bert Belder
8b9f7c6eb2 Make Read and Write in node_net.cc actually work on sockets 2010-12-20 23:51:12 +01:00
Bert Belder
13fb6f7fa1 Make Socket, Bind, Listen, Accept work for windows 2010-12-20 23:51:11 +01:00
Bert Belder
51300f36d6 Make SetNonBlock and SetSockFlags work on FDs instead of sockets
However, don't use _get_osfhandle in Close()
2010-12-20 23:51:10 +01:00
Bert Belder
6e522fb27b Use the c-ares pton/ntop hack in node_net.cc as well 2010-12-20 23:51:10 +01:00
Bert Belder
9f9332963a wscript: use "node.exe" and avoid symlinks on windows 2010-12-20 23:51:09 +01:00
Bert Belder
9a9edb0e8e Performance-killing bug workaround for V8 on mingw
When V8 on mingw generates a _compiled_ call stub for an external api callback, it fucks up the stack.
It doesn't set the stack pointers properly. Could be due to subtly different calling conventions?
This patch disables the simple_api_call optimization. It hurts performance.
2010-12-20 23:51:08 +01:00
Bert Belder
3216f08b6d Ignore eclipse project files 2010-12-20 23:51:07 +01:00
Bert Belder
1d0193a733 Wafadmin: don't even think about using msvc 2010-12-20 23:51:07 +01:00
Bert Belder
f37cc8720b On windows, link with Winsock and WinMM 2010-12-20 23:51:06 +01:00
Bert Belder
6f08fdbcca Backslashes in paths wreak havoc 2010-12-20 23:51:05 +01:00
Bert Belder
d56e1a3fcd No -rdynamic and -pthread flags when building with mingw 2010-12-20 23:50:47 +01:00
Bert Belder
276b0b174e Always use statically linked c-ares on windows; fix build
On win32 CARES is always static, so we can call internal functions like ares_inet_pton et al.
CARES_STATICLIB must be defined or gcc will try to make DLL stub calls
2010-12-20 23:50:46 +01:00
Bert Belder
3947269f97 Mingw32 has no inet_pton/inet_ntop; import them from c-ares (hack) 2010-12-20 23:50:45 +01:00
Bert Belder
d7de459b80 Use ares_socket_t instead of int for sockets 2010-12-20 23:50:45 +01:00
Bert Belder
6e54f416ad Fix header files for node_cares.cc 2010-12-20 23:50:44 +01:00
Bert Belder
1937c5e3c1 On windows, there's no support (yet) for chown and symlink functions 2010-12-20 23:50:43 +01:00
Bert Belder
51c6867280 On windows, stat() doesn't give you block (size) info 2010-12-20 23:50:43 +01:00
Bert Belder
f9a74a2327 On windows, mkdir() doesn't take a mode parameter 2010-12-20 23:50:42 +01:00
Bert Belder
8fc3bac868 Fix fsync/fdatasync for windows 2010-12-20 23:50:41 +01:00
Bert Belder
fae7b81589 On windows use eio__pread and eio__pwrite (hack) 2010-12-20 23:50:41 +01:00
Bert Belder
c7f0341d88 Include windows.h in node_file.cc 2010-12-20 23:50:40 +01:00
Bert Belder
a85a776268 Most of node_net is not yet available on windows 2010-12-20 23:50:39 +01:00
Bert Belder
7a1917d86f Make SetNonBlock and SetSockFlags work on mingw 2010-12-20 23:50:39 +01:00
Bert Belder
cbf73fcccd Fix headers for node_net.cc 2010-12-20 23:50:38 +01:00
Bert Belder
cd921c2c62 S_IFLNK, S_IFSOCK and SIGCHLD are not available on windows 2010-12-20 23:50:37 +01:00
Bert Belder
81b26dc555 Stat watchers don't work on windows yet 2010-12-20 23:50:37 +01:00
Bert Belder
b4510d57dc There is no child process support for windows yet 2010-12-20 23:50:36 +01:00
Bert Belder
6d1af51de6 Fix header files for node_buffer.cc 2010-12-20 23:50:35 +01:00
Bert Belder
30bab52741 Disable node.cc functions that are not supported on windows 2010-12-20 23:50:35 +01:00
Bert Belder
dcc3508890 There's no SIGCHLD on windows 2010-12-20 23:50:34 +01:00
Bert Belder
4a42e408d2 Properly intialize winsock 2010-12-20 23:50:33 +01:00
Bert Belder
a177d60e2b Fix headers for node.cc 2010-12-20 23:50:33 +01:00
Bert Belder
ae8906e7d1 Add errno.h to platform_win32.cc 2010-12-20 23:50:32 +01:00
Bert Belder
518fa2e29a node_stdio stub for windows 2010-12-20 23:50:31 +01:00
Bert Belder
b85c4c445b Macros for warning about unimplemented APIs 2010-12-20 23:50:30 +01:00
Bert Belder
8a3132a406 Avoid WCHAR string conversion warning 2010-12-20 23:50:30 +01:00
Bert Belder
0b54514a86 errno is reserved; use errorno 2010-12-20 23:50:29 +01:00
Bert Belder
63bff5434d No implementation for OS::GetExecutablePath and OS::GetMemory yet 2010-12-20 23:50:28 +01:00
Bert Belder
e98a06d90f Make winapi_perror public 2010-12-20 23:50:28 +01:00
Bert Belder
dae9752973 Stub out platform_win32.h 2010-12-20 23:50:27 +01:00
Bert Belder
62af617f84 Dynamically link with pthreads-w32
Adds some explanation what would need to be done to link pthreads statically
2010-12-20 23:50:26 +01:00
Bert Belder
13699c1b33 V8: Don't attempt to build w/ snapshot, doesn't seem to work on mingw32 2010-12-20 23:50:26 +01:00
Bert Belder
2463dbb3fd Fix v8 build on mingw32 2010-12-20 23:49:56 +01:00
Jeremy Martin
6f726cf8c7 url.parse(url, true) defaults query field to {} 2010-12-20 13:48:44 -08:00
Ryan Dahl
8db0bbe0dc Add callback to CryptoStream.write 2010-12-20 11:08:51 -08:00
Ryan Dahl
fca713eba4 Add doc for Buffer.isBuffer 2010-12-18 18:44:04 -08:00
Ryan Dahl
41d73e02a2 cleartext.socket always exists 2010-12-18 16:38:32 -08:00
Ryan Dahl
bb27885251 TLS: check we're not disconnected before Cleartext blow 2010-12-18 15:34:10 -08:00
Ryan Dahl
3cf2cbf904 Parse issuer and subject from CryptoStream.getPeerCertificate 2010-12-18 11:26:54 -08:00
Ryan Dahl
24aded078f Add optional filters to stream.pipe() 2010-12-17 13:56:47 -08:00
Ryan Dahl
a8f666ebb8 Now working on v0.3.3-pre 2010-12-17 10:10:23 -08:00
Ryan Dahl
4bb914bde9 Bump version to v0.3.2 2010-12-17 09:51:48 -08:00
Ryan Dahl
d1f36accbf Remove toJSON usage - it was removed from V8 2010-12-17 09:50:41 -08:00
Ryan Dahl
7d425a0a16 Upgrade V8 to 3.0.3 2010-12-17 09:47:55 -08:00
Brian White
9eaf2329e7 Fix compilation on OpenBSD and FreeBSD
While it compiles fine on FreeBSD, at least on amd64 node dies with:
"CALL_AND_RETRY_0 allocation failed - process out of memory"
2010-12-17 09:06:31 -08:00
Ryan Dahl
d0beac70f4 Revert "Simplify next tick logic by looping around ev_loop"
This reverts commit 241ea7e595.

Fixes GH-511: https://github.com/ry/node/issues/issue/511
2010-12-16 18:41:13 -08:00
Jorge Chamorro Bieling
e530507cb1 Add failing test for GH-511 2010-12-16 18:41:13 -08:00
Brian White
6d75c06e64 Add os module to repl's built-in lib list 2010-12-16 17:37:00 -08:00
Ryan Dahl
2dc17e93ee Add oprofile patch to repo 2010-12-16 14:25:02 -08:00
Ryan Dahl
02aae22397 Add solaris patch file 2010-12-16 14:22:50 -08:00
Ryan Dahl
c9d3a81db0 Patch V8 to compile on solaris 2010-12-16 14:05:13 -08:00
Ryan Dahl
033ab7ebb6 Add 5 sec timeout to test-tls-securepair-client
This test is broken for people who don't have OpenSSL 1.0.0 - but it's just
a bug in OpenSSL. Add this timeout so that it doesn't take super long to run
the tests.
2010-12-16 12:23:38 -08:00
Ryan Dahl
c6406f9e57 Apply V8 r5951 to fix Mac build
From f3973972b727df480697443871d780596aba0201 Mon Sep 17 00:00:00 2001
From: erik.corry@gmail.com <erik.corry@gmail.com@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Date: Wed, 8 Dec 2010 16:23:25 +0000
Subject: [PATCH] Speed up quoting of JSON strings by allocating a string that is big enough
 and then trimming it when the length is known.  This way we only have to
 traverse the input once.
 Review URL: http://codereview.chromium.org/5556012
2010-12-16 12:10:54 -08:00
Ryan Dahl
ea700a8851 Upgrade V8 to 3.0.2 2010-12-16 11:52:08 -08:00
Ryan Dahl
632da2a393 Add callback paramenter to socket.connect() 2010-12-15 15:57:41 -08:00
Ryan Dahl
c4161f32f5 Add callback to socket.write() 2010-12-15 15:47:02 -08:00
Ryan Dahl
c970968ee6 better option parsing for socket.write() 2010-12-15 15:15:27 -08:00
Ryan Dahl
1dad95a3a9 Print 'make clean' commands 2010-12-13 22:13:51 -08:00
Ryan Dahl
7d73779446 Make oprofile work 2010-12-13 22:12:46 -08:00
Ryan Dahl
1d78159e8f Upgrade V8 to 3.0.1 2010-12-13 22:12:14 -08:00
isaacs
3d0627dc6a link windows/cygwin build to the wiki docs
Suggested by temp01 in IRC.
http://irc.npmjs.org/node.js/2010-12-12#NODE-JS-2010-12-12T18-59-36-270Z
18:59:36 temp01: I feel like the build section on nodejs.org should link
there
19:11:18 isaacs: temp01: yeah, that'd be helpful
2010-12-13 21:01:36 -08:00
Felix Geisendörfer
e27418ca3f Prefer require.cache over native module cache
This patch changes node's module loading behavior so that the
require.cache is always the first place to consider when loading a
module.

The motivation for this change is to help people who are writing
focused tests for their node.js applications, and need a mechanism
to inject test doubles to replace native node.js modules.
2010-12-13 17:58:24 -08:00
Ryan Dahl
a59483bd1d TLS: server should die on junk 2010-12-11 02:45:38 -08:00
Ryan Dahl
c9e5cfcc34 Random doc fixes 2010-12-11 02:32:48 -08:00
Ryan Dahl
5bdcec67f0 Add docs for tls.connect() 2010-12-11 02:26:48 -08:00
Ryan Dahl
e3d1808ef0 Rename node::SecureStream to node::crypto::Connection
node::SecureStream is definitely not a "stream" in the Node sense. Renaming
it to avoid ambiguity. (Adding namespace to not confuse with some other
Connection object.)
2010-12-11 02:13:29 -08:00
Ryan Dahl
6636bfaa0a TLS: Simplify code from suck and blow 2010-12-11 01:42:55 -08:00
Ryan Dahl
66767edf12 Add CryptoStream.destroy() 2010-12-11 01:21:25 -08:00
Ryan Dahl
953561ab06 Factor out CryptoStream.end; support data on end() 2010-12-11 01:18:45 -08:00
Ryan Dahl
4f2ab03e97 Fix typo 2010-12-11 00:56:58 -08:00
Brian White
f1762ff815 Add os module and getHostname 2010-12-11 00:51:20 -08:00
Ryan Dahl
dc65cbd2e9 Factor out some _cycle functionality into Cleartext and EncrypteStreams 2010-12-10 22:29:46 -08:00
Ryan Dahl
70baeba8a9 Add receivedShutdown() binding 2010-12-10 22:09:46 -08:00
Ryan Dahl
d4f1ab00d2 Add EncryptedStream and CleartextStream classes
Towards half-closed secure sockets.
2010-12-10 18:25:23 -08:00
Ryan Dahl
8ef683dead Rename the securepair test to be prefixed with tls 2010-12-10 18:03:39 -08:00
Ryan Dahl
c444293be9 Start a simple TLS client verification test 2010-12-10 18:02:58 -08:00
Ryan Dahl
32e8692b06 Apply V8 r5951 to fix Mac build
From f3973972b727df480697443871d780596aba0201 Mon Sep 17 00:00:00 2001
From: erik.corry@gmail.com <erik.corry@gmail.com@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Date: Wed, 8 Dec 2010 16:23:25 +0000
Subject: [PATCH] Speed up quoting of JSON strings by allocating a string that is big enough
 and then trimming it when the length is known.  This way we only have to
 traverse the input once.
 Review URL: http://codereview.chromium.org/5556012
2010-12-10 11:22:12 -08:00
Ryan Dahl
5138992f3c Add some verification code to tls.connect() 2010-12-09 02:46:57 -08:00
Ryan Dahl
a473b8dafb Move getPeerCertificate and getCipher to CryptoStream 2010-12-09 02:31:22 -08:00
Ryan Dahl
2ca63c8f79 Initial implementation of tls.connect()
Seems to work checkout test/disabled/tls-client.js
Type "GET /" after connected.
2010-12-09 00:38:12 -08:00
Ryan Dahl
137c361517 pair.cleartext, pair.encrypted now instances of tls.CryptoStream 2010-12-09 00:10:27 -08:00
Ryan Dahl
5a87bd168d Remove doc references to readyState 2010-12-08 16:04:21 -08:00
Ryan Dahl
a3c91c216f Simplify the net.Server example in docs 2010-12-08 13:46:02 -08:00
Ryan Dahl
9a7fb3c988 Add tls.Server docs 2010-12-08 13:22:12 -08:00
Ryan Dahl
dac4d486ec Accept Buffers as well as strings for addCert, addKey 2010-12-08 13:21:50 -08:00
Ryan Dahl
0ea0b921b7 TLS: emit 'secureConnection' instead of two events 2010-12-08 12:05:19 -08:00
Ryan Dahl
a952231640 remove old todo 2010-12-08 11:55:13 -08:00
Ryan Dahl
bb46b63e33 test-tls-server-verify: add ca2 test case 2010-12-08 11:55:04 -08:00
Ryan Dahl
13b14300b9 TLS: emit 'end' on both streams 2010-12-08 11:51:41 -08:00
Ryan Dahl
a0c55dfe09 TLS: don't use events when control hasn't been inverted 2010-12-08 11:46:19 -08:00
Ryan Dahl
0ec57ea34c Some TLS clean ups 2010-12-08 11:27:17 -08:00
Ryan Dahl
5d60b06b76 Add 'make test' to test/fixtures/keys/Makefile 2010-12-07 17:13:51 -08:00
Ryan Dahl
6bc9b2ef92 clients without certs are unauthed. 2010-12-07 16:51:23 -08:00
Ryan Dahl
ee5366a410 Fix CNs for agent keys; can't be the same as CA's CN
Also add makefile for easy tweaking.
2010-12-07 16:36:10 -08:00
Ryan Dahl
c30f113712 Upgrade V8 to 3.0.0 2010-12-07 13:56:11 -08:00
Ryan Dahl
5b8c62f7d1 Add broken, but detailed TLS verify test
Plus a bunch of keys.
2010-12-07 11:53:41 -08:00
Ryan Dahl
180dfca03f Pretty error message messes up if readFileSync in main module fails.
TODO test/message test for this.
2010-12-07 11:29:20 -08:00
Ryan Dahl
0b0faceb19 Move securepair stuff into tls.js 2010-12-05 18:19:18 -08:00
Ryan Dahl
5bca100afe Server must not request cert. 2010-12-05 18:13:20 -08:00
Oleg Efimov
093dfaf801 GJSLint all tests, only 3 long lines left in test-url.js
test/simple/test-url.js:31:(0110) Line too long (82 characters).
test/simple/test-url.js:39:(0110) Line too long (85 characters).
test/simple/test-url.js:40:(0110) Line too long (92 characters).
2010-12-05 15:42:41 -08:00
Oleg Efimov
0665f0271e GJSLint all simple tests exclude http-*, url, path 2010-12-05 15:41:58 -08:00
isaacs
47c40bf18d test-fs-realpath: Put junk in tmp, not fixtures.
Prevents test/fixtures/cycles/folder/cycles from being created every time
the tests are run.
2010-12-05 15:28:15 -08:00
isaacs
dc2b4b2a81 test-fs-realpath: move absDir fetching to separate function 2010-12-05 15:27:01 -08:00
isaacs
6525c04522 test-fs-realpath: lint 2010-12-05 15:26:48 -08:00
Oleg Efimov
0ce9cbab29 GJSLint continue 2010-12-05 09:28:18 -08:00
Oleg Efimov
e76cd53431 Small site fix for image borders and nodejs-dev maillist URL 2010-12-04 18:47:32 -08:00
Ryan Dahl
02cc39f221 Check for global leaks in all tests 2010-12-04 16:36:21 -08:00
Ryan Dahl
92789b16e5 Fix global leaks 2010-12-04 16:36:21 -08:00
Ryan Dahl
a0159b4b29 Fix global leaks 2010-12-04 15:58:50 -08:00
Ryan Dahl
fbdff52b44 Fix global leaks in test-buffer.js 2010-12-04 13:40:21 -08:00
Ryan Dahl
5a21138e37 fix global leak 2010-12-04 13:39:28 -08:00
Anders Conbere
e9c7195471 Reworks the two functions traverser and findModulePath into a more readable form.
This is not the supposed end of these changes, but a first change that
should make future changes easier to reason about.
2010-12-04 13:20:01 -08:00
Devin Torres
8c6a7b5de4 Use more color in the repl, loosely inspired by TextMate's SunBurst theme 2010-12-03 16:07:20 -08:00
Anders Conbere
c4f8f871c9 adding module tests for .js and bare files
Currently the module tests don't cover the cases for when a user
requires a file with a request that includes the extension, and for a
request to a file with no extensions.

ex.

require("./a.js") // not tested
require("./foo") // (not tested with trying to load a file named ./foo)
2010-12-03 16:00:10 -08:00
Sean Braithwaite
fcc38129a3 Check buffer length using string length
+ Utf8Length is really slow but has the same semantics in this case
2010-12-03 15:55:03 -08:00
Ryan Dahl
c70acbb1a3 implement openpty for sun 2010-12-03 20:49:25 +00:00
Brian White
e41e078159 Make sure REPL doesn't get borked when invalid REPL keywords are entered 2010-12-03 09:57:36 -08:00
Brian White
e4bca19843 Fix tty changes for OSX 2010-12-03 09:29:48 -08:00
Ryan Dahl
a0e9a510b0 Introduce require('tty')
You may need to reconfigure after this commit due to the new library.
2010-12-02 18:06:43 -08:00
Oleg Efimov
c0d69a4883 GJSLint part of tests 2010-12-02 17:49:23 -08:00
Ryan Dahl
d3532a4bf2 Fix indention in 'make test-message' 2010-12-02 17:01:18 -08:00
Ryan Dahl
33685fee48 Add configure flag for oprofile 2010-12-02 16:57:16 -08:00
Ryan Dahl
da96e07bbe fix global leak 2010-12-02 16:45:34 -08:00
Ryan Dahl
712c74fc7a test-securepair-client: handle broken stdout packets 2010-12-02 16:38:23 -08:00
Ryan Dahl
ea9006a5bc print warning on process.ENV 2010-12-02 15:59:35 -08:00
Ryan Dahl
558e5ba2b0 lint util.js and src/node.js 2010-12-02 12:27:26 -08:00
isaacs
7c57eb2aec lint url.js 2010-12-02 11:46:32 -08:00
Oleg Slobodskoi
c5c1dc5dda docs for assert.throws 2010-12-02 11:07:47 -08:00
Tom Hughes
e681abe5cb cmake: solaris fixes. 2010-12-02 10:36:10 -08:00
Tom Hughes
cf1811a6d3 cmake: Add valgrind support. 2010-12-02 10:36:02 -08:00
Tom Hughes
b46f10a11f cmake: Add coverage support. 2010-12-02 10:35:39 -08:00
Micheil Smith
a1138c6f2a Cleanup Makefile for JSLint, CPPLint 2010-12-02 09:21:02 -08:00
Ryan Dahl
dd53ceebe4 lint 2010-12-01 20:59:06 -08:00
Ryan Dahl
e232f6e735 more lint 2010-12-01 20:28:28 -08:00
Brian White
ddbaeef1b3 Fix executable path on FreeBSD. 2010-12-01 20:28:17 -08:00
Ryan Dahl
09329cbb04 more lint 2010-12-01 17:43:30 -08:00
Ryan Dahl
f22c248e4c more lint 2010-12-01 17:29:11 -08:00
Ryan Dahl
ac58d3a665 Import cpplint.py
make cpplint
make jslint
make lint
2010-12-01 17:01:25 -08:00
Ryan Dahl
11ea8da9c3 lint child_process.js 2010-12-01 16:56:03 -08:00
Ryan Dahl
db78043d52 lint 2010-12-01 16:42:31 -08:00
Ryan Dahl
a128451004 Import Google's closure_linter
Run with 'make lint'
2010-12-01 16:42:26 -08:00
Ryan Dahl
08d8116f6b style 2010-12-01 13:43:05 -08:00
Ryan Dahl
cd48649c61 Require without .js in test-repl 2010-12-01 13:40:28 -08:00
Ryan Dahl
d8f2880ca4 New TLS server API 2010-12-01 13:00:17 -08:00
Ryan Dahl
ec1589875c Stop watcher before calling .set() in Stream.prototype.resume 2010-12-01 12:52:34 -08:00
Ryan Dahl
127f17a0ea Remove should_verify from C++ - to handle in JS land 2010-12-01 12:47:49 -08:00
Ryan Dahl
c5d32b3c64 add todo 2010-12-01 12:32:37 -08:00
Ryan Dahl
5dab4be53c Remove useless shouldVerify assignments 2010-12-01 11:31:22 -08:00
Ryan Dahl
89e398f075 Better array check in Cert Authority list 2010-12-01 11:23:25 -08:00
Ryan Dahl
855210ce0b add shouldVerifyPeer param to SecurePairs 2010-12-01 09:27:13 -08:00
Ryan Dahl
28a86c3e56 Remove unnecessary call to X509_STORE_free 2010-12-01 09:27:13 -08:00
Ryan Dahl
504a80dc6d Rename VerifyPeerError to VerifyError 2010-12-01 09:26:59 -08:00
Ryan Dahl
1fe450c62c fix typo 2010-11-30 23:06:57 -08:00
Ryan Dahl
09229820e7 Add promotejs
Over 2 months late -- this is how much I procrastinate. -_-
2010-11-30 23:00:37 -08:00
Michael W
5f3464cf4e fixed timers, whoops.
Fixes issue https://github.com/ry/node/issues/issue/481
2010-11-30 22:33:29 -08:00
Ryan Dahl
355936dcde Implement SecureContext destructor 2010-11-30 18:19:54 -08:00
Ryan Dahl
ea540c94f8 Better verify info 2010-11-30 18:19:54 -08:00
Ryan Dahl
4b947310b2 Move root certs out of JavaScript 2010-11-30 18:19:54 -08:00
Ryan Dahl
09157369b3 style 2010-11-30 18:19:54 -08:00
Ryan Dahl
e15e214747 Fix test-child-process-cwd.js on Joyent servers
It's symlinked to /usr/bin so this test fails.
2010-11-30 19:53:51 +00:00
Ryan Dahl
7286b79521 Upgrade V8 to 2.5.9.1 2010-11-30 11:37:43 -08:00
Ryan Dahl
486c74e72b Revert "Default to TLSv1"
This reverts commit 97970b05fe.
2010-11-30 11:33:05 -08:00
Ryan Dahl
70188499b0 Lazy load console object 2010-11-30 11:18:02 -08:00
Ryan Dahl
81afb54c0a Fix comment 2010-11-30 11:04:31 -08:00
Ryan Dahl
db98d6e4e0 Remove assert in verify_peer; add comments 2010-11-30 10:55:04 -08:00
Bert Belder
5ea2a61596 win: Duplicate platform_cygwin.cc into platform_win32.cc 2010-11-29 23:49:29 -08:00
Bert Belder
fa94d55f87 win: C-ares build config for win32 2010-11-29 23:48:58 -08:00
Bert Belder
4a329af418 win: Waf doesn't detect sys/select.h on mingw, but its there for sure 2010-11-29 23:48:34 -08:00
Bert Belder
4c16dd7c5c win: Make libev use send instead of write for sockets
It looks like MINGW doesn't like to write() to sockets.
If wrong, revert this patch
2010-11-29 23:47:48 -08:00
Bert Belder
4476ce04dc win: Export eio__pread and eio__pwrite so node_file can use it 2010-11-29 23:46:46 -08:00
Bert Belder
d1d4695474 win: Fix wscript for libeio on windows 2010-11-29 23:46:40 -08:00
Bert Belder
5a36d1b86f win: Make libeio build on windows 2010-11-29 23:46:35 -08:00
Bert Belder
99ba903d46 win: Define __POSIX__ constant when the platform is POSIX-y 2010-11-29 23:46:30 -08:00
Bert Belder
9032bfce59 win: Symlink to jsmin.py doesn't work on windows 2010-11-29 23:46:17 -08:00
Ryan Dahl
aed0ba3211 buffer.copy targetStart defaults to 0 2010-11-29 19:59:01 -08:00
Ryan Dahl
6d7242b485 Document defaults for buffer.copy() 2010-11-29 19:52:47 -08:00
Ryan Dahl
a326eebac8 Put tools/ into PYTHON_PATH 2010-11-29 19:46:00 -08:00
Michael W
645c3b3713 Fixed: clearTimeouts calling multiple times
When clearTimeouts was called on a timer multiple times, it would break the
doubly-linked list along with future timeouts. This patch fixes that.
2010-11-29 18:17:13 -08:00
Travis Swicegood
22cf5a24db Simplify execution from "big if statement"
This code is functionally equivalent, but in a simpler form.  Now new
parameters to `execFile` do not require `exec` to be refactored.
2010-11-29 17:46:46 -08:00
Travis Swicegood
e514f575f3 Remove cruft that dealt with env parameter
Originally added in commit 078a48a9, this code dealt with an optional
env parameter that was passed to `exec`.  The parameter was removed, but
this code was left.  As it serves no purpose, removing it.
2010-11-29 17:43:27 -08:00
Ryan Dahl
1dbbaa7fa0 Add test to show ECONNREFUSED works 2010-11-29 17:36:59 -08:00
Jeremy Martin
144b2a5338 Fix number of args emitted by EventEmitter during "fast case" (lte 3 args) 2010-11-29 17:25:50 -08:00
Oleg Slobodskoi
02083412eb assert.throws can now accept as RegExp
makes validation of errors more flexible
2010-11-29 17:22:36 -08:00
Travis Swicegood
86727b15f3 fix a typo in comment
fixes issue 464
2010-11-29 17:07:30 -08:00
Evan Larkin
bc02d47b21 Fix variable leak.
Fixes issue 461
2010-11-29 17:07:25 -08:00
Ryan Dahl
711196cafa Don't call exit() from the signal handler
Fixes issue #457
2010-11-29 16:19:28 -08:00
Ryan Dahl
3fceb491d4 Style 2010-11-29 16:19:28 -08:00
Ryan Dahl
b6face1dce Remove unnecessary variable def 2010-11-29 15:04:39 -08:00
Ryan Dahl
735b9d50a3 Simplify state transitions in http.Client
Fixes new bug shown in test-http-allow-req-after-204-res.js pointed out by
Tom Carden <tom.carden@gmail.com>.
2010-11-29 14:21:51 -08:00
Ryan Dahl
85827bde34 Avoid cascading EADDRINUSE test failure
See note in test-securepair-client.js
2010-11-29 14:21:51 -08:00
Ryan Dahl
6057747e9e Improve HTTP debug messages 2010-11-29 13:53:35 -08:00
Ryan Dahl
1db59afb75 style 2010-11-29 08:57:40 -08:00
Ryan Dahl
7a7feb8cd3 Add note about EADDRINUSE to docs 2010-11-29 00:20:21 -08:00
Ryan Dahl
105501c195 test-fs-realpath: Don't ceate things in /tmp; use tmpDir 2010-11-29 00:10:37 -08:00
Ryan Dahl
97970b05fe Default to TLSv1 2010-11-28 23:24:32 -08:00
Ryan Dahl
bf89872306 style 2010-11-28 23:20:59 -08:00
Ryan Dahl
be2457aaca Use SSL_MODE_RELEASE_BUFFERS by default. 2010-11-28 21:03:41 -08:00
Ryan Dahl
8012f2cb7a Add some TODO items 2010-11-28 18:41:53 -08:00
Ryan Dahl
102b1d999d Add simple securepair client test 2010-11-28 18:40:50 -08:00
isaacs
a52f59b437 Use a proper tty test. 2010-11-27 11:36:34 -08:00
Tom Hughes
6285fac232 Allocations with new[] must be freed with delete[].
See http://valgrind.org/docs/manual/mc-manual.html#mc-manual.rudefn
2010-11-24 12:53:28 -08:00
Tom Hughes
7fcfb7b981 Fix memleak in ChildProcess:Spawn(). 2010-11-24 12:51:46 -08:00
Ryan Dahl
73318fa09d Upgrade V8 to 2.5.8 2010-11-24 01:03:06 -08:00
Nikhil Marathe
fa8ffaf9b2 cmake: Install v8 headers include/node 2010-11-23 23:33:20 -06:00
Nikhil Marathe
1b6b090cdc Use CMake's standard way to find Python.
Rather than have the python literal string, use CMake's find_package
to find actual python executable. This is more useful if you have
both Python 2 and 3 installed. CMake currently only supports python 2
and so will automatically find that version
2010-11-23 23:33:20 -06:00
Tom Hughes
14e6b07f63 cmake: Add cdash support. 2010-11-23 23:33:20 -06:00
Tom Hughes
342b8b2ed2 cmake: fix debian package description. 2010-11-23 23:33:20 -06:00
Daniel Gröber
ea29cb4e46 cmake cleanup
* Removed useless include_directories
 * Print ssl library path in build summary
 * ExternalProject also exists on 2.8.0
 * include pummel tests when testing with ctest
 * Moved tests.cmake to test/CMakeList.txt
 * Removed inconsistent, unnecessary condition in else
2010-11-23 23:33:19 -06:00
Tom Hughes
a530c23d96 cmake: Add wrapper Makefile and README. 2010-11-23 23:33:19 -06:00
Ryan Dahl
b57c1f51b9 Saner, yet still ugly, fix to displaying syntax errors 2010-11-23 18:46:13 -08:00
Ryan Dahl
a6f6532dfb Fix test-securepair-server 2010-11-23 18:30:52 -08:00
isaacs
a2b3c865c9 Correct reference to "process.Module" 2010-11-23 14:09:59 -08:00
Wade Simmons
03e5da8429 Fix ErrnoExceptions that have the wrong syscall name 2010-11-23 14:09:16 -08:00
Ryan Dahl
4f32a59307 Fix buffer.slice(0, 0) 2010-11-23 12:20:22 -08:00
Ryan Dahl
f123a1ab40 hack to display syntax errors. FIXME 2010-11-22 17:55:04 -08:00
Tom Hughes
446beebd79 Add cmake build support.
Squashed commit of ca128f7dcd with
contributions from Mark Constable (markc@renta.net) and Daniel Gröber
(darklord@darkboxed.org).
2010-11-22 13:32:49 -08:00
isaacs
b52b4196ab Fix problem with requireNative not exporting 'module' object
Broke require('constants'). Add unrelated test which breaks it.
2010-11-22 11:55:31 -08:00
Ryan Dahl
12554380d5 Add support for SSDP methods -_- 2010-11-21 21:44:23 -08:00
Ryan Dahl
d695486185 Upgrade http-parser 2010-11-21 21:39:14 -08:00
Ben Noordhuis
b64791c7e4 Fix c-ares bug: reply to a CNAME query
doesn't contain addresses, causing ares_parse_a_reply() to bail out with
ARES_ENODATA.
2010-11-21 20:54:53 -08:00
Ben Noordhuis
611dffabb6 Support CNAME lookups in DNS module. 2010-11-21 20:53:57 -08:00
Jorge Chamorro Bieling
6aa92d5289 Apple's threaded write()s bug
fixes test/simple/test-fs-sir-writes-alot.js on mac
2010-11-21 20:44:48 -08:00
Ryan Dahl
7b2f5ab7f8 Fix mac build 2010-11-21 20:33:04 -08:00
Ben Noordhuis
f0b8cc6a94 require() should work with node --eval.
with tests

Fix module path resolve bug.  Normally the module path is taken from
realpath(__filename) but with eval there is (of course) no filename
2010-11-21 20:24:26 -08:00
Nikhil Marathe
7a3971e433 Use sys.executable to call python 2010-11-21 19:27:23 -08:00
Ben Noordhuis
80b5a52217 Fix compiler warnings. 2010-11-21 19:11:05 -08:00
Ben Noordhuis
a87172f9b2 Compile with -Wno-unused-parameter -D_FORTIFY_SOURCE=2 2010-11-21 19:07:27 -08:00
Marco Rogers
5749f91814 Docs for util.inherits 2010-11-21 19:03:23 -08:00
Herbert Vojčík
3422263414 requireNative made independent on module system 2010-11-21 18:17:44 -08:00
Ryan Dahl
f6479f2fb6 Print deprecation warning on process.compile 2010-11-21 15:22:08 -08:00
Ryan Dahl
a16b3c3148 Use runInNewContext instead of process.compile 2010-11-21 15:16:02 -08:00
Ryan Dahl
b1088d6bd2 Load 'path' module with requireNative
(now that requireNative does not depend on path module)
2010-11-21 15:07:38 -08:00
Ryan Dahl
bb6d468dd8 requireNative doesn't depend on rest of module system 2010-11-21 15:06:20 -08:00
Silas Sewell
11b2ee7632 Various doc tweaks (2-spaces vs tabs, EOL-whitespace, repl prompt, "world" vs "World", etc...) 2010-11-21 14:33:09 -08:00
Ryan Dahl
c11f3f8b0f simplify lazy constant loading 2010-11-21 14:20:22 -08:00
Ryan Dahl
6063ea62df fix style in path.js 2010-11-21 14:15:46 -08:00
Ryan Dahl
5890272538 Print friendly error message when main module is ENOENT 2010-11-21 13:58:47 -08:00
Ryan Dahl
c321e9893d stream.pipe should remove listeners on dest close 2010-11-20 23:08:45 -08:00
Ryan Dahl
2320497992 Revert "Merge branch 'writev'"
This reverts commit cd9515efd9, reversing
changes made to df46c8e698.

Too slow. Needs more work.
2010-11-20 20:55:15 -08:00
Ryan Dahl
794e7be4f8 Revert "Actually don't need to limit sendmsg size on unix - seems okay."
This reverts commit 464ced4a86.
2010-11-20 20:45:30 -08:00
Ryan Dahl
d42098651b Revert "fd_to_send needs to be cleared if *any* data was sent"
This reverts commit a93634007a.
2010-11-20 20:45:22 -08:00
Marco Rogers
118b88e44f update repl to distinguish JSON.parse SyntaxErrors from the rest 2010-11-20 20:36:14 -08:00
Ryan Dahl
56074d1056 Inline Buffer::Length and Buffer::Data 2010-11-20 00:04:22 -08:00
Ryan Dahl
a93634007a fd_to_send needs to be cleared if *any* data was sent 2010-11-19 23:05:13 -08:00
Ryan Dahl
464ced4a86 Actually don't need to limit sendmsg size on unix - seems okay. 2010-11-19 22:52:20 -08:00
Ryan Dahl
15d5378684 Add failing test for TLS server 2010-11-19 13:28:13 -08:00
Ryan Dahl
d722c8df73 Add some comments to securepair 2010-11-19 13:02:14 -08:00
Ryan Dahl
7515360951 fix style for SecureStream::IsInitFinished 2010-11-19 12:58:00 -08:00
Ryan Dahl
cbdcc1d5f3 Upgrade V8 to 2.5.7 2010-11-19 10:49:09 -08:00
Nikhil Marathe
f11291a220 Added documentation for Stream.pipe 2010-11-19 10:09:01 -08:00
Ryan Dahl
9c29ac6feb Fix style 2010-11-19 10:05:41 -08:00
Brian White
952bbb86b5 Fix OpenSSL SSL_library_init function check on OpenBSD. 2010-11-18 21:47:15 -08:00
Ryan Dahl
296802c641 Update TODO 2010-11-18 16:57:46 -08:00
Ryan Dahl
cd9515efd9 Merge branch 'writev' 2010-11-18 16:49:39 -08:00
Ryan Dahl
1f18648394 Fix typo 2010-11-18 16:47:38 -08:00
Ryan Dahl
2ba3c10d62 Only try to flush big buffers once 2010-11-18 16:47:38 -08:00
Ryan Dahl
849792e46b Add todo about test-pipe.js and throwing on resume() 2010-11-18 16:47:38 -08:00
Ryan Dahl
544877d12e Fix socket.end() problem on non-empty queue 2010-11-18 16:47:38 -08:00
Ryan Dahl
0b1214c16b Fix a bug regarding queueSize, add asserts 2010-11-18 16:47:38 -08:00
Ryan Dahl
3884b4185a Small clean ups 2010-11-18 16:47:38 -08:00
Ryan Dahl
02039c9b53 'connect' event may disconnect socket 2010-11-18 16:47:38 -08:00
Ryan Dahl
42357645cb Dump after ev_loop 2010-11-18 16:47:38 -08:00
Ryan Dahl
d3fbe3e3d1 Emit drain and stop IOWatcher even on empty buffer 2010-11-18 16:47:38 -08:00
Ryan Dahl
fa556a1425 Add callback to socket.write(), fix test-sendfds 2010-11-18 16:47:38 -08:00
Ryan Dahl
a6d8425382 make sure unix sockets are tagged correctly 2010-11-18 16:47:38 -08:00
Ryan Dahl
5d6a03c9fe Don't append buckets of zero length 2010-11-18 16:47:38 -08:00
Ryan Dahl
10ff559ec3 Add IOWatcher.flush()
To be called if sockets get too much data. This is to force a flush before
the tick ends.
2010-11-18 16:47:37 -08:00
Ryan Dahl
7c3c5c6861 Maintain queueSize for each socket 2010-11-18 16:47:37 -08:00
Ryan Dahl
5a84461e46 Also do ondrain callback for socket (needed by http) 2010-11-18 16:47:37 -08:00
Ryan Dahl
e1250a3333 Reset _eof on socket reuse 2010-11-18 16:47:37 -08:00
Ryan Dahl
5ba0be6166 Don't send null data segments 2010-11-18 16:47:37 -08:00
Ryan Dahl
d74c506044 Support encoding 2010-11-18 16:47:37 -08:00
Ryan Dahl
dcc547d798 Dumper net.js integration 2010-11-18 16:47:37 -08:00
Ryan Dahl
913789da3e IOWatcher::Dump(), writev 2010-11-18 16:47:31 -08:00
Ryan Dahl
df46c8e698 Rip out the old TLS implementation 2010-11-18 16:46:37 -08:00
Ryan Dahl
2a750bffcc Add tests for querystring.unescapeBuffer 2010-11-18 16:22:14 -08:00
Oleg Efimov
8b980d729c Fix line wrapping in docs. Add tics for constants in docs text. 2010-11-18 15:41:15 -08:00
Stéphan Kochen
57eb5cb9a0 Make SlowBuffer pass Buffer.isBuffer test. 2010-11-18 15:36:09 -08:00
Ryan Dahl
6ff12c425e Add querystring.unescapeBuffer 2010-11-18 15:18:06 -08:00
Ryan Dahl
57d8172906 query-string unescape moved to js land 2010-11-18 15:12:31 -08:00
Ryan Dahl
2219c64a04 fix race in test-http-big-proxy-responses.js 2010-11-18 13:50:54 -08:00
Brian White
5908bdab9a Make sure raw mode is disabled when exiting a terminal-based REPL. 2010-11-17 18:45:34 -08:00
Ryan Dahl
bce092aeb8 Remove leading comma examples 2010-11-17 18:25:14 -08:00
Micheil Smith
57de0b11db Remove jQuery from project 2010-11-17 17:57:58 -08:00
Ryan Dahl
9f1b27bf76 Add doc TODOs 2010-11-17 17:50:00 -08:00
Micheil Smith
8d27393aa2 Generate Table of Contents at compile time. 2010-11-17 17:38:54 -08:00
Dan Søndergaard
8591057fa3 Better description of lstat(). Wrapped all lines. 2010-11-17 16:11:51 -08:00
Tim Cooijmans
d4b726a1a6 fix utils.inspect's detection of circular structures 2010-11-17 16:06:17 -08:00
Ryan Dahl
9da29a6109 Fix links 2010-11-17 14:51:06 -08:00
Ryan Dahl
241ea7e595 Simplify next tick logic by looping around ev_loop
This is also in preparation for the writev patch, which needs to dump
remaining data after ev_loop ends.
2010-11-17 13:22:11 -08:00
Ryan Dahl
17307e386e Fix doc links 2010-11-17 09:39:26 -08:00
Ryan Dahl
c87b7b7c69 Now working on v0.3.2-pre 2010-11-17 09:31:51 -08:00
Ryan Dahl
ce9a54aa1f Bump version to v0.3.1 2010-11-16 19:17:44 -08:00
Ryan Dahl
03fa258df7 Revert "Upgrade V8 to 2.5.6"
This reverts commit 564a48643b.

Breaks cygwin
2010-11-16 19:14:14 -08:00
Ryan Dahl
cea3a95f9f Add ref to buffer during fs.write and fs.read
There was the possibility the buffer could be GCed while the eio_req was
pending.  Still needs test coverage for the fs.read() problem.

See:
http://groups.google.com/group/nodejs/browse_thread/thread/c11f8b683f37cef
2010-11-16 16:26:55 -08:00
Ryan Dahl
cf05257fb7 Test for server.listen() more carefully, fix bug 2010-11-16 15:33:21 -08:00
Ryan Dahl
a01e09502e scp should copy the right dir 2010-11-15 22:25:09 -08:00
Ryan Dahl
9bf93de532 Update TODO 2010-11-15 22:18:52 -08:00
Ryan Dahl
84a5a69d9f Fix doc links on index.html 2010-11-15 20:34:15 -08:00
Ryan Dahl
e5cc6388cb Docs for server.address() 2010-11-15 20:26:46 -08:00
Ryan Dahl
90d1e47323 make doc improvements 2010-11-15 20:23:14 -08:00
Ryan Dahl
4144024e6b Test and fix for self-assigned port from net.Server 2010-11-15 20:22:54 -08:00
Micheil Smith
939fba40fd Better doc indexes, fix some links 2010-11-15 19:59:21 -08:00
Micheil Smith
ade8cf96e0 Build API page into build/doc; simplify doctool. 2010-11-15 19:49:52 -08:00
Ryan Dahl
879a9e0548 solaris -> sunos 2010-11-16 03:23:47 +00:00
Ryan Dahl
702a923da7 Fix docs for vm module 2010-11-15 19:21:56 -08:00
Ryan Dahl
473721979d Print warning when using platform_none.cc 2010-11-16 03:19:01 +00:00
Ryan Dahl
00a1d61cc8 Fix OS::GetExecutablePath for platform_none 2010-11-16 03:06:18 +00:00
Ryan Dahl
8b1082825c Rename require('javascript') to require('vm') 2010-11-15 18:37:27 -08:00
Ryan Dahl
183f6c2077 Add .node_moudles to lookup path again 2010-11-15 11:21:48 -08:00
Ryan Dahl
a375c6ae9a Revert node_module lookup commits
Revert "Add ~/.node_modules as well as ~/.node_libraries"

This reverts commits
5e14c8bec0.
b0adaff67e.
492fc0d752.
2010-11-15 11:20:49 -08:00
Ryan Dahl
19ed02b286 Fix docs for 'javascript' module 2010-11-15 00:51:01 -08:00
isaacs
d39d3cec65 Make the javascript module API nodey.
Add a createScript function, and put stuff on exports instead of hiding
it in exports.Script.
2010-11-15 00:44:08 -08:00
Ryan Dahl
6b71e0b038 Remove RonnJS not used anymore 2010-11-15 00:43:53 -08:00
Ryan Dahl
0b7fb01e67 Remove old TODO 2010-11-14 23:44:34 -08:00
Ryan Dahl
d7e7161b27 Add small crappy manpage (please improve) 2010-11-14 23:12:43 -08:00
isaacs
9996b459e1 Implement new path.join behavior
1. Express desired path.join behavior in tests.
2. Update fs.realpath to reflect new path.join behavior
3. Update url.resolve() to use new path.join behavior.
2010-11-14 22:49:26 -08:00
Ryan Dahl
25eecd179b Fix configure on x86 2010-11-14 22:46:26 -08:00
Micheil Smith
a6c3d7121b Reworked and cleaned up documentation for Events 2010-11-14 13:52:34 -08:00
Micheil Smith
f9ad171085 Added documentation for which module to require to use the methods defined in that documentation 2010-11-14 13:52:34 -08:00
Micheil Smith
09e60aa435 A few changes to the style, specifically for h3 + h3 2010-11-14 13:52:34 -08:00
Micheil Smith
17595b5343 Various changes to Net Documentation, ammended style for API. 2010-11-14 13:52:31 -08:00
isaacs
589e27948b writeFile fixes
writeFileSync could exhibit pathological behavior when a buffer could
not be written to the file in a single write() call.

Also, writeFile was not quite as optimized as it could be.
2010-11-14 01:43:30 -08:00
Ryan Dahl
d787a444c5 Use require('javascript') instead of process.binding('evals') 2010-11-13 15:19:15 -08:00
Ryan Dahl
bc0118e519 Remove process.compile from docs 2010-11-13 15:08:09 -08:00
Ryan Dahl
b842fbd602 Update gitignore for new docs 2010-11-13 15:02:18 -08:00
Ryan Dahl
320e0020a2 fix 'make doc' 2010-11-13 14:59:15 -08:00
Bert Belder
e129630e9e Fix V8 build on Cygwin 2010-11-13 14:38:25 -08:00
Ben Noordhuis
5d80bdb6ae Add --profile flag to configure script, enables gprof profiling. 2010-11-13 14:34:45 -08:00
Rasmus Andersson
e5a0fbe500 Added support for cross compilation and also fixed DEST_CPU to represent the canonical symbols dictated by v8 2010-11-13 14:29:59 -08:00
Ryan Dahl
de6e88c428 Fix segfault on test-crypto
Plus random cleanups. This code needs help.
2010-11-13 14:26:42 -08:00
Ryan Dahl
8e09b1e2e1 Simplify REPL displayPrompt
Now that we insert \r into the stream and aren't switching back and forth
between termios modes, not need to worry about when to display the prompt.
2010-11-12 14:39:42 -08:00
Ryan Dahl
564a48643b Upgrade V8 to 2.5.6 2010-11-11 22:42:06 -08:00
Ryan Dahl
d4af8a6b6a Add writeFilter when in the readline
Switch \n with \r\n for all strings printed out.
Necessary for writev patch.
2010-11-11 22:37:17 -08:00
Ryan Dahl
c7b24efd21 Move ev_loop out of javascript 2010-11-11 16:34:26 -08:00
Ryan Dahl
4b4d4afa0a joyent-ize website 2010-11-11 16:34:11 -08:00
Ryan Dahl
06267f4d8d Remove -e from echo in test. Non-portable 2010-11-10 22:32:26 -08:00
Ryan Dahl
d23643051e Upgrade http-parser again 2010-11-10 22:12:47 -08:00
Ryan Dahl
8285f12864 Upgrade http-parser 2010-11-09 15:02:18 -08:00
Ryan Dahl
c6029c75a4 Remove util.print from docs
Use process.stdout.write()
2010-11-07 17:22:56 -08:00
Guillaume Tuton
07da49b095 Set FD_CLOEXEC flag on stdio FDs before spawning.
With regression test.
2010-11-07 13:07:14 -08:00
Ryan Dahl
a3750a9833 Remove unnecessary ref/unref in iowatcher cb 2010-11-05 17:38:02 -07:00
Ben Noordhuis
b4def4806c Make writes to process.env update the real environment. Tests included. 2010-11-03 12:15:07 -07:00
Ryan Dahl
029180a93c Install node-waf 2010-11-03 09:02:54 -07:00
Ryan Dahl
6ce007e89a Remove warning in 'sys' - too aggressive 2010-11-02 21:20:28 -07:00
Ryan Dahl
515f006b6e Add legacy methods to Buffer 2010-11-02 10:09:59 -07:00
Ryan Dahl
07812c47a4 Add test for http-buffer problem
Already fixed in 7e24a05cba
2010-11-01 18:23:13 -07:00
Ryan Dahl
97c9745063 Back to WAF
Too much instability right now. Hopefully we can revisit autoconf soon.
2010-11-01 16:51:20 -07:00
Ryan Dahl
41c1563584 Remove old buffer api 2010-11-01 14:59:30 -07:00
Ryan Dahl
f1391f33cd Add missing require('fs') 2010-11-01 14:56:21 -07:00
Ryan Dahl
ea78d995e0 Upgrade V8 to 2.5.3 2010-11-01 14:10:35 -07:00
Ryan Dahl
fd725efa8f Add execinfo to freebsd LINKFLAGS 2010-11-01 13:36:03 -07:00
Ben Noordhuis
7a7e88d44b Fix 'undefined symbol' errors when loading native modules. 2010-11-01 12:57:28 -07:00
Oleg Efimov
6bf97808ee Add node headers installation 2010-11-01 09:58:21 -07:00
Oleg Efimov
fac6db1b56 Add DESTDIR support to Makefile 2010-11-01 09:57:27 -07:00
Chandra Sekar S
2b08bacd56 Removed range read optimization as it doesn't work with libeio. 2010-11-01 08:28:57 -07:00
Ryan Dahl
2fa260cef6 Clean up 'make clean' 2010-10-31 19:31:31 -07:00
Ryan Dahl
ae802e3867 Improper use of CFLAGS 2010-10-30 17:03:26 -07:00
Ryan Dahl
7c90ff5d41 Add configure --enable-debug to make it build both 2010-10-30 16:11:30 -07:00
Ryan Dahl
5e11b8a937 De-indent dns.lookup 2010-10-30 13:31:51 -07:00
Ryan Dahl
9c2969253b Make sure watcher.set() isn't being called when active 2010-10-30 12:52:53 -07:00
Ryan Dahl
016fdab43e Fix argv[6] comment in node_file 2010-10-30 12:04:30 -07:00
Micheil Smith
98e7d3506f Rewrite libeio After callback to use req->result instead of req->errorno for error checking 2010-10-30 11:45:43 -07:00
Ryan Dahl
ef9e716fd1 Delete libv8 in 'make clean' 2010-10-30 11:14:18 -07:00
Ryan Dahl
268bcbde7c Upgrade V8 to 2.5.2 2010-10-30 11:13:37 -07:00
Ryan Dahl
ccdd979a69 Changes to compile on solaris 2010-10-30 11:03:42 -07:00
Ryan Dahl
7a48fd8455 Handle null values in clearTimeout 2010-10-29 00:00:43 -07:00
Ryan Dahl
fa7dcbec8b Install node-waf 2010-10-28 19:43:36 -07:00
Ryan Dahl
9bea4c8d58 X the node-repl script 2010-10-28 19:41:44 -07:00
Micheil Smith
818e56d44b Disable make manpage, this is broken and can prevent node from installing correctly. 2010-10-28 17:17:04 -07:00
Ryan Dahl
23927751eb Fix make doc 2010-10-28 15:14:19 -07:00
Micheil Smith
a6f246b9f5 Removing the old doc templates, and doc javascript 2010-10-28 15:02:41 -07:00
Micheil Smith
c9f656baa9 More simplification of the templating & rendering. 2010-10-28 14:59:15 -07:00
Micheil Smith
d4f1e6a023 Added a single page version, moved index to be standard page. 2010-10-28 14:59:15 -07:00
Micheil Smith
c032350f64 Adding build tools & templates/assets 2010-10-28 14:59:15 -07:00
Micheil Smith
e190c9616e Splitting documentation 2010-10-28 14:59:15 -07:00
Ryan Dahl
1eb547fec1 Lazy load modules in net.js 2010-10-28 13:15:53 -07:00
Ryan Dahl
5171da5a6c Remove a little redundancy 2010-10-28 13:11:42 -07:00
Ryan Dahl
65dced730f Handle one more onReadable call from crypto
MUST get rid of this calledByIOWatcher stuff. Hopefully will be able to when
securepair stuff lands.
2010-10-28 12:34:48 -07:00
Ryan Dahl
73cfda12bb Abstract out a Server.prototype.pause method 2010-10-28 11:42:22 -07:00
Ryan Dahl
ad61d77fa3 Abstract out net.Server.prototype._rejectPending
Does the same timeout action for maxConnections as it does for EMFILE.
2010-10-28 11:33:35 -07:00
Jonas Pfenniger
74d0a077ec Module-level EMFILE handling
All net servers now share the same dummy socket. The ulimit warning is
throttled for all servers.
2010-10-28 11:12:59 -07:00
Rasmus Andersson
899fffa395 Build system improvements: (cross compilation, libnode, etc)
- utilizing autoconf configure.guess to output canonical $target_{cpu,vendor,os}
- normalizing $target_cpu --> $arch according to v8 naming scheme
- normalizing $target_os --> $platform according to v8 naming scheme
- renamed c-ares platform-arch directories to represent v8 canonical names
- new targets in Makefile: libnode-{static,dynamic}[-debug]
- scons is symbolized as SCONS in Makefile for portability/flexibility.
- LINKFLAGS inherith from LDFLAGS ("magic" variable exported by autoconf and configure).
- When building on OS X, CFLAGS and LDFLAGS will contain appropriate -arch flag, set up by configure (instead of the Makefile).
- libv8.a make targets cleaned up with unison libv8_flags set of flags.
- the clean make target now cleans up libraries (libv8, libnode, etc).
- added config.guess, config.sub and install-sh (utilized by autoconf/configure)
2010-10-27 17:15:32 -07:00
isaacs
987cbbc191 Handle cyclic links smarter in fs.realpath
Rather than aborting in the face of *any* repeated link in a given path,
instead only abort if such a cycle actually makes a given path unresolvable.

Test for this by doing a normal stat.  Still use the seenLinks object to
cache link contents so as to cut own a little bit on readlink calls.

Also add a pathological test that fails without the change to fs.js.
2010-10-27 17:02:42 -07:00
isaacs
4c514a723c Let exit listeners know the exit code 2010-10-27 16:54:10 -07:00
Jorge Chamorro Bieling
fd70d30a9c make "node --eval" eval in the global scope. 2010-10-27 16:52:53 -07:00
Ryan Dahl
67652ddf27 Refactor callbacks in net.Stream for fewer closures 2010-10-27 16:43:16 -07:00
Ryan Dahl
38dde9684f Add extra anti-DoS tech to net.Server 2010-10-27 12:09:16 -07:00
Ryan Dahl
aeb9bed63e Improve idle benchmarks 2010-10-27 02:52:49 -07:00
Ryan Dahl
ac54272218 Gracefully handle EMFILE
Implementing a tip from Marc Lehmann:
http://pod.tst.eu/http://cvs.schmorp.de/libev/ev.pod#The_special_problem_of_accept_ing_wh

Keep an extra FD around for every server. When you hit EMFILE, destroy that
FD, accept a connection, close it; in this way you can clear the connection
queue and let people know that you're overload.

No more timeout needed.
2010-10-27 02:12:25 -07:00
Tim-Smart
79ecc8e9b7 Style changes. 2010-10-26 18:47:46 -07:00
Ryan Dahl
bc47353bbe Use the timer list for setTimeout 2010-10-26 14:53:18 -07:00
Ryan Dahl
79944006e2 Move setTimeout and friends into timers module 2010-10-26 14:53:17 -07:00
Ryan Dahl
5cc29b80f2 Move idle timers into its own module 2010-10-26 14:53:17 -07:00
Ryan Dahl
dcc4fffe4d Add C++ API for constructing fast buffer from string 2010-10-26 13:43:58 -07:00
Ryan Dahl
d1e5fbdde4 Remove old TODOs 2010-10-26 11:33:18 -07:00
Ryan Dahl
72aee8216c Fix permissions on http.js 2010-10-26 11:31:01 -07:00
Ryan Dahl
9bbc7e0bc7 Remove old todo 2010-10-26 01:10:32 -07:00
Ryan Dahl
2470d2ee92 allowHalfOpen disabled by default
Users too often would forget to add

  socket.on('end', function () {
    socket.end();
  });

Which is a mistake. Therefore we default to this behavior and
only optionally let people handle the 'end' case themselves.
2010-10-26 01:10:18 -07:00
Ryan Dahl
a7b4af0ae5 create directories during configure 2010-10-25 19:52:58 -07:00
Ryan Dahl
5175864c0e exec instead of sh a the configure.real script 2010-10-25 19:52:35 -07:00
Ryan Dahl
43022eabf7 more configure hackery 2010-10-25 18:33:15 -07:00
Ryan Dahl
eaba4fc2bf Ignore configure.real 2010-10-25 18:24:48 -07:00
Ryan Dahl
5cf4ceff59 add configure 2010-10-25 18:21:45 -07:00
Ryan Dahl
583c07bf8b fix style 2010-10-25 17:30:08 -07:00
Paul Querna
97977640bd Set the readable variables on the read/write streams
and add more debug() calls to make it easier to see the flow
2010-10-25 17:28:21 -07:00
Paul Querna
1128c0bf67 Add SecurePair for handling of a ssl/tls stream. 2010-10-25 17:26:58 -07:00
Paul Querna
6ea61acf29 remove old todo. 2010-10-25 17:26:44 -07:00
Paul Querna
1ce4684a27 Centralize error handling in SecureStream
and add a start method, to kick off SSL handshaking, without writing a zero
byte buffer
2010-10-25 17:26:03 -07:00
isaacs
446d2ec19c Add make install 2010-10-25 13:43:09 -07:00
Micheil Smith
8da020d39e Update node_net.cc to make us of node_constants.cc
also affects dgram which uses a constant from node_net.cc
2010-10-25 12:14:47 -07:00
Paul Querna
9977831078 Add HAVE_OPENSSL flag to makefile 2010-10-25 10:28:14 -07:00
Ryan Dahl
7eed71f8bb add todo about half-open connections 2010-10-24 20:11:47 -07:00
Ryan Dahl
fcd0c3ebc0 Remove test-base64-bigfile
Already tested in test/simple/test-buffer.js. Takes too long, uses too much
memory.
2010-10-24 19:21:12 -07:00
Ryan Dahl
15594eaf87 Replace WAF with make/autoconf 2010-10-24 18:39:36 -07:00
Ryan Dahl
bb85e7751f Now working on v0.3.1 2010-10-23 16:01:37 -07:00
Ryan Dahl
1582cfebd6 bump version to 0.3.0 2010-10-23 16:00:15 -07:00
Ryan Dahl
477df1aaec Revert "Add some failing tests for path.join"
This reverts commit 8c0e87f9c3.

(Revert until fix comes)
2010-10-23 15:35:58 -07:00
Ryan Dahl
38f117cb6d one more 'listening' race condition 2010-10-23 14:26:31 -07:00
Ryan Dahl
44234e9cc7 Fix a few 'listening' race conditions
in
test-net-timeout
test-http-client-parse-error
2010-10-23 14:13:04 -07:00
Ryan Dahl
0ac2ef924f Do not spin on aceept() with EMFILE
When a server hit EMFILE it would continue to try to accept new connections
from the queue. This patch introduces a timeout of one second where it will
stop trying to accept new files. After the second is over it tries again.

This is a rather serious bug that has been effecting many highly concurrent
programs. It was introduced in 4593c0, version v0.2.0.

TODO: A test for this situation. Currently I test it like this

  termA% cd projects/node
  termA% ulimit -n 256
  termA% ./node benchmark/idle_server.js

  termB% cd projects/node
  termB% ./node benchmark/idle_clients.js

And watch how the server process behaves.
2010-10-23 12:28:20 -07:00
Ryan Dahl
9bf2975f78 Make sure Error object on exec() gets killed member
Also default to SIGTERM for destruction when exceeding timeout or buffer on
exec()
2010-10-23 11:37:40 -07:00
Ryan Dahl
d9a5edb2b0 Fix test-net-eaddrinuse 2010-10-23 11:22:24 -07:00
Stéphan Kochen
dd52737476 Provide a C++ Buffer constructor for external storage.
In order to do this, buffer data management was moved out of the
JS entry-point New, and into Replace.

Secondly, the constructor makes an immediate call to Replace, and
in order for ArrayData calls to work, wrapping must already be set
up. Now, the constructor takes the wrappee as a parameter.
2010-10-22 16:52:14 -07:00
Stéphan Kochen
b3e60c7b25 Generalize Buffer::Copy to work with all unsigned byte external data. 2010-10-22 13:47:10 -07:00
Stéphan Kochen
d5e966154c Simplify things by using *ArrayData everywhere. 2010-10-22 13:32:48 -07:00
Stéphan Kochen
d9b08d66d6 Remove old interface remains from Buffer.
These were all lacking implementation, so deprecating wouldn't help.
2010-10-22 13:32:31 -07:00
Ryan Dahl
b2969a9155 Don't call AtExit twice 2010-10-22 10:17:38 -07:00
Vitali Lovich
fb8830a64f Fix parsing of linux memory
If process name contains a space, this parsing fails for no good reason.
2010-10-22 10:14:19 -07:00
Ryan Dahl
604f4fdf8c Write write.txt into the tmpdir 2010-10-22 10:02:30 -07:00
Ryan Dahl
92c5634cbd Remove a confusing sentence in the docs 2010-10-21 17:32:13 -07:00
Jorge Chamorro Bieling
99e19aa398 Remove unneeded function wrappers 2010-10-21 17:11:59 -07:00
Ryan Dahl
174a3a9a08 Upgrade libev to 4.00 2010-10-21 15:38:32 -07:00
Ryan Dahl
3b861db31d Upgrade V8 to 2.5.1 2010-10-21 15:22:38 -07:00
Ryan Dahl
2629296c25 Add isatty for isaacs 2010-10-21 12:34:37 -07:00
Ryan Dahl
ceb5331a64 Force exit on SIGINT but still reset flags on stdio fds
Add test that one can ctrl+c out of a script spinning infinitely.
2010-10-21 12:28:04 -07:00
Ryan Dahl
33e45bbe46 Add incomplete R plot file 2010-10-20 21:28:49 -07:00
Ryan Dahl
6570cd99e5 Fix execFile timeouts, improve tests
It seems that a parent will not get a SIGCHLD if the child is killed by the
parent? It's unclear, so make 'exit' callback manually.
2010-10-20 19:20:52 -07:00
Ryan Dahl
5a98fa4809 ChildProcesses cannot be killed if pid is missing 2010-10-20 17:55:25 -07:00
Tom Hughes
78da9cb052 Add --max-stack-size flag.
v8 doesn't expose a command-line flag to set the stack size, so this
adds a new flag that node understands how to handle and uses v8's
ResourceConstraints API.
2010-10-20 15:57:13 -07:00
isaacs
5e14c8bec0 Add ~/.node_modules as well as ~/.node_libraries 2010-10-20 15:46:13 -07:00
isaacs
b0adaff67e require looks in node_modules folders
for modules starting with the __dirname and moving up.

This makes it much easier to localize dependencies to a particular program.
2010-10-20 15:45:47 -07:00
isaacs
bfc6b51d95 The cwdRequire hack is no longer necessary with the require.resolve refactor. 2010-10-20 15:22:02 -07:00
isaacs
492fc0d752 Split out modulePaths and defaultPaths
This way, the "default" paths of ~/.node_libraries and {prefix}/lib/node are only checked *after* anything that the user has placed into the NODE_PATHS environ, or pushed onto require.paths.

This makes require.paths a much more effective write-target, albeit slightly less useful as a read-target.  However, given the existence of require.resolve(), this is less of an issue -- if you want to know what a module ID will map to, just ask that question and get an authoritative answer from the loading machinery.
2010-10-20 15:21:33 -07:00
isaacs
b0aadbea6b Docs for require.resolve 2010-10-20 15:20:04 -07:00
Ryan Dahl
8c0e87f9c3 Add some failing tests for path.join 2010-10-20 13:03:49 -07:00
Aaron Heckmann
bd8e4f656e Prevents child_process.exec timeouts from throwing when the child was previously killed. 2010-10-20 12:46:51 -07:00
isaacs
226eff5104 Add require.resolve.
Also, hack the repl so that it works as expected there, too.
2010-10-20 12:12:07 -07:00
Ryan Dahl
3407dab07f Remove old references to old 'stream' event 2010-10-20 11:10:43 -07:00
Nikhil Marathe
179a7f6ffa Added documentation of EventEmitter.once 2010-10-20 11:09:40 -07:00
Ryan Dahl
a313f38c34 use bash instead of sh in http_simple_bench.sh 2010-10-18 17:48:49 -07:00
Ryan Dahl
1b2f6f9e29 Upgrade V8 to 2.5.0 2010-10-18 17:13:30 -07:00
Johan Euphrosine
5d400cfd3a net listen should emit eaddrinuse error 2010-10-18 17:00:13 -07:00
Mark Nottingham
b14eeb3c1e Fix expect/continue keepalive 2010-10-18 15:38:46 -07:00
Jorge Chamorro Bieling
c735b4663a unbase64 skips over *any* illegal chars 2010-10-18 15:22:10 -07:00
Ryan Dahl
40f675b64b Fix race conditions in test-http-upgrade-client2 2010-10-18 15:05:18 -07:00
Ryan Dahl
4adadc38f4 fix test-base64-bigfile for linux 2010-10-18 15:00:49 -07:00
Ryan Dahl
97255c2651 Fix test harness for Linux
Mostly just upgraded tools/test.py to the latest one that's in V8.  But also
fixing the before and after hooks to preserve the test/tmp directory so that
running tests manually usually works.
2010-10-18 14:54:39 -07:00
Sami Samhuri
56df0cbf93 new api for defining repl commands 2010-10-18 13:46:54 -07:00
AJ ONeal
74c8b5fd08 ./wscript: allow for cross-compiling of all three supported architectures 2010-10-18 11:39:56 -07:00
isaacs
25b5bc01a6 A big base64 file encoding/decoding test
Originally written to try to track down this bug report:
http://permalink.gmane.org/gmane.comp.lang.javascript.nodejs/13924

As it turns out, it's showing a completely different kind of failure.  When
the file is base64 encoded with the native program, then decoded with node,
it doesn't match the original.  Something's fishy.
2010-10-18 11:36:23 -07:00
Ryan Dahl
cf1db4f304 base64 decode should handle whitespace 2010-10-18 11:34:35 -07:00
Ryan Dahl
ccf2a04ea2 Install ev.h and eio.h 2010-10-17 22:57:40 -07:00
Peteris Krumins
a6ee3bac85 Add EventEmitter.prototype.once 2010-10-16 20:43:09 -07:00
Ryan Dahl
3cf4827ae0 Add idle connection test 2010-10-15 12:11:50 -05:00
Ryan Dahl
ff456b3886 Add 'make bench' script 2010-10-13 16:20:24 -07:00
Ryan Dahl
cdde22a27d Improve benchmark/http_simple.js 2010-10-13 14:30:50 -07:00
Nathan Rajlich
9b1ff070e6 Upgrade http-parser with a fix for spaces in headers 2010-10-13 02:47:10 -07:00
Joshua Peek
73b29d79b9 Don't flush net writeQueue on end() if its still connecting 2010-10-13 02:37:53 -07:00
Ben Noordhuis
045bd4c7a4 Preliminary pkg-config support. 2010-10-13 01:49:33 -07:00
Ryan Dahl
6691aca229 Allow people to set backlog. Need a better API. 2010-10-13 01:47:29 -07:00
Tom Hughes
f61b110cf6 Add signal handlers so we clean up before exiting.
Add SIGTERM and SIGINT signal handlers so that we run the exit handlers
before exiting when getting these signals. Fixes an issue where we
couldn't run vi after CTRL+C'ing node because the stdin fd was left
non-blocking.
2010-10-12 14:01:58 -07:00
Ryan Dahl
0fcb3bd3a9 Add .js to native script's filename 2010-10-12 11:54:45 -07:00
Ryan Dahl
c4636a578c Dynamically load native scripts 2010-10-12 11:49:41 -07:00
Ryan Dahl
901d5fd0d2 Don't require events in fs.js 2010-10-11 16:40:28 -07:00
Ryan Dahl
32aadd9400 fs.ReadStream and fs.WriteStream derive from stream.Stream 2010-10-11 16:39:40 -07:00
Ryan Dahl
8139bb24c1 Add destroy methods to HTTP messages
needs tests (particularly for pipeline situations)
2010-10-11 16:36:14 -07:00
Micheil Smith
372a7c9a3e Migrated from sys.p to console.dir 2010-10-11 16:21:45 -07:00
Micheil Smith
d2c47b4f87 Removed deprecated methods from lib/path.js 2010-10-11 16:21:21 -07:00
Micheil Smith
a3604cf233 Removed deprecated methods from lib/net.js 2010-10-11 16:20:08 -07:00
Micheil Smith
0e1a581916 Removed deprecated methods from lib/http.js 2010-10-11 16:20:08 -07:00
Micheil Smith
7bfefb5250 Removed deprecated methods from lib/fs.js 2010-10-11 16:20:08 -07:00
Micheil Smith
83db91be41 Removed deprecated alias to lib/fs.js 2010-10-11 16:20:04 -07:00
Micheil Smith
c1aa8ea944 Removed deprecated events.Promise 2010-10-11 16:16:18 -07:00
Ryan Dahl
ee8522996a Enable pipe test 2010-10-11 16:08:53 -07:00
Ryan Dahl
1879d8211d Remove sys in new tests 2010-10-11 16:07:18 -07:00
Ryan Dahl
7e24a05cba Fix test-http-buffer-sanity 2010-10-11 16:00:36 -07:00
Micheil Smith
e38eb0c5a4 Soft migration of sys -> util, Removal of deprecated utils module. 2010-10-11 15:21:36 -07:00
Ryan Dahl
0a0e90dcca Add broken test passing a buffer through http 2010-10-11 14:54:32 -07:00
Rasmus Andersson
50443f08e0 environ symbol fix for Mac OS X 2010-10-11 11:19:55 -07:00
Ryan Dahl
2944e03a03 Closer to a working pipe 2010-10-11 01:22:38 -07:00
Ryan Dahl
007881b648 No long have tcp module 2010-10-11 01:22:24 -07:00
Felix Geisendörfer
3cd09e7ba5 Stress test for http upload timeouts
This was meant to find a bug in setTimeout, but there doesn't seem to be
one. So this test can no help to prevent future regressions.
2010-10-11 00:25:48 -07:00
Ryan Dahl
1d3142a882 TCP clients should buffer writes before connection 2010-10-10 23:09:14 -07:00
Ryan Dahl
81ac0d5088 pipe-test fixes 2010-10-10 22:10:47 -07:00
Ryan Dahl
cdd1d675a7 Remove old tcp module 2010-10-10 20:57:33 -07:00
Ryan Dahl
393f0071e4 Improve pipe-test. Still not working 2010-10-10 20:18:47 -07:00
Ryan Dahl
8ab691726d clean up options.end code - wasn't working 2010-10-10 20:16:21 -07:00
Micheil Smith
1af52d28ca Changing http.js to use the same stream.Stream creation as net.js 2010-10-10 19:43:21 -07:00
Ryan Dahl
9d248f690a Fix return in Buffer::New 2010-10-10 19:24:33 -07:00
Ryan Dahl
0cf03ab800 Add char* constructor for Buffer 2010-10-10 19:08:51 -07:00
Ryan Dahl
bc695475b9 Add Stream base class with stream.pipe 2010-10-10 17:27:03 -07:00
Ryan Dahl
fe74283e1d Fix a few compiler warnings... 2010-10-09 16:04:38 -07:00
Ryan Dahl
a6017660d8 More clang fixes 2010-10-09 15:10:45 -07:00
Ryan Dahl
5dd08c6c71 Ugly fix for clang 2010-10-09 14:21:33 -07:00
Ryan Dahl
f23eb282c0 Fix style 2010-10-09 12:48:22 -07:00
Ryan Dahl
783f5019b0 Add flag to disable colors in REPL 2010-10-09 12:46:06 -07:00
Ryan Dahl
39b9043bef Use readline.columns in sys.inspect when possible
Though, this should probably be an option to sys.inspect and be set by REPL.
2010-10-09 12:40:17 -07:00
Ryan Dahl
d164989e3f Commas last in sys.inspect
Ugly? Yes. More readable by first time users? Yes.
2010-10-09 12:18:17 -07:00
Ryan Dahl
b5359e40be Warnings for new C++ buffer API 2010-10-09 12:15:16 -07:00
Sean Coates
ae87007478 add $ to variable name character matching patterns in repl completer 2010-10-09 10:04:13 -07:00
Ryan Dahl
634c4bf0b0 Add missing v8 file... 2010-10-09 00:56:37 -07:00
Ryan Dahl
f7a9eea0d4 Add config.h for cygwin for libev and libeio 2010-10-09 00:56:16 -07:00
Ryan Dahl
0003c701bc expose parsers freelist 2010-10-07 16:17:06 -07:00
Ryan Dahl
54e844cf08 add require.cache 2010-10-07 09:58:08 -07:00
Joshaven Potter
3d4e4d8909 syntax fixes to pass jslint 2010-10-06 20:40:57 -07:00
TJ Holowaychuk
9481bc1009 Added -e, --eval 2010-10-06 19:09:22 -07:00
Ryan Dahl
5986a582d9 #define HAVE_FDATASYNC 0 for darwin; 10.5 is missing it 2010-10-05 15:25:33 -07:00
Ryan Dahl
7fca101338 Upgrade V8 to 2.4.8 2010-10-05 15:25:07 -07:00
Ryan Dahl
dbf0d6bb70 ClearWeak on ObjectWraps. I /think/ this is the correct semantics 2010-10-04 12:52:46 -07:00
isaacs
8ff7954165 Fix #325. Add test and check for zero-length file contents in fs.readFileSync 2010-10-04 12:50:58 -07:00
Ryan Dahl
38f8665f3a lib/http.js - nested loop stepping on variables of outer loop
Fixes #318.
2010-10-04 10:50:37 -07:00
Ryan Dahl
48d7a1edc1 libev, libeio config.h files don't depend on arch 2010-10-02 15:07:54 -07:00
David Siegel
3faa3b56f3 libev libeio: added freebsd-x86 config headers 2010-10-02 06:44:55 -07:00
Ryan Dahl
29cc78f824 Simpler libev and libeio config 2010-10-02 06:44:55 -07:00
isaacs
e9b6b0b327 Report "weird" errors a little better.
There are a few kinds of errors that are very confusing.
1. Errors raised in nextTick
2. Errors emitted on the "error" event
3. RangeErrors that crash the program (or anything without a stack trace)

Long traces will make make these better, of course.  In the meantime, this
adds a few handy signposts (in the form of better error reporting and
comments on the otherwise inscrutable code printed to the terminal) that can
help new users find the cause, or at least, ask for help more effectively.
2010-10-02 06:44:28 -07:00
Mark Nottingham
d59512f6f4 Add support for handling Expect: 100-continue
HTTP/1.1 requests, either with an event (check_continue) or automatically, if no event handler is present.

Add client-side expect/continue support, tests.

Expound upon client requirements for expect/continue.
2010-10-01 15:30:53 -07:00
Marco Rogers
4a7562d28f fix encoding option on ReadStream, updated test 2010-10-01 15:16:25 -07:00
Ryan Dahl
c9627e0a0d Upgrade V8 to 2.4.7 2010-10-01 14:19:11 -07:00
Ryan Dahl
5829716649 Fix REPL crash on tabbing 'this.'
Thanks to Tim Becker for pointing this out.
2010-10-01 11:31:22 -07:00
Ryan Dahl
5a4c40beea Drop reference to timer callback on clearTimeout
Reported here:
http://groups.google.com/group/nodejs-dev/browse_thread/thread/9e063d0938f99879

Would be good to test this somehow...
2010-10-01 11:16:51 -07:00
Evan Larkin
914ff78df6 fs.ReadStream: Passing null for file position on all reads except the first read of a range read. 2010-09-30 18:23:30 -07:00
Ryan Dahl
265cda97d7 Fix zero length buffer bug for http res.end()
Reported by Kadir Pekel <kadirpekel@gmail.com>
2010-09-30 17:13:01 -07:00
Mark Nottingham
1b24fc6678 Consume HTTP trailing headers 2010-09-30 16:30:40 -07:00
Evan Larkin
43ddc04bb0 No longer using the global variable "stat" in unwatchFile 2010-09-30 16:19:59 -07:00
Ryan Dahl
5cc1428d5f Remove unused function 2010-09-30 12:20:33 -07:00
Ryan Dahl
1a2c1c8a96 Simplify: per-module cache thing 2010-09-30 12:18:58 -07:00
Ryan Dahl
ee9af66990 Add test for getting parse error from HTTP client
Made this test in response to this thread:
http://groups.google.com/group/nodejs/browse_thread/thread/f82835007a277de2/
But Node appears to be working correctly.
2010-09-30 11:48:19 -07:00
Ryan Dahl
c3bc48d451 Move the http client's initParser() into prototype 2010-09-30 11:41:50 -07:00
Ryan Dahl
f323f34353 writeable -> writable 2010-09-29 16:12:30 -07:00
Ben Noordhuis
55c65cc2d5 Safe constructor for ObjectWrapped classes
New() methods should be invoked as constructors, not regular functions.
Corner cases like Script::New() may cause a SIGSEGV when the GC is run.

More details: http://groups.google.com/group/nodejs/browse_thread/thread/a7e5db68d4cd6356
2010-09-29 16:02:45 -07:00
Ryan Dahl
9911629de0 Fix style in node_crypto.cc 2010-09-28 19:17:09 -07:00
Ryan Dahl
163485c8aa Rename some SecureStream methods 2010-09-28 11:38:27 -07:00
Ryan Dahl
7bd94712a8 lazy load crypto binding 2010-09-28 11:27:13 -07:00
Ryan Dahl
d89f8dce28 fix style in net.js 2010-09-28 11:27:09 -07:00
Ryan Dahl
fe060916ec Put preprocessor defines into CPPFLAGS not compile flags... 2010-09-28 03:17:44 -07:00
Ryan Dahl
3a64c22cc1 Disable a few more libev features 2010-09-28 03:11:33 -07:00
Ryan Dahl
069d973d74 Remove require('buffer') in built-in libraries. 2010-09-28 02:31:31 -07:00
Aaron Heckmann
7c5cc57ece quicker loops 2010-09-28 01:14:58 -07:00
Ryan Dahl
f9d6b074cf output time of function calls 2010-09-28 01:14:38 -07:00
Ryan Dahl
353e2565d5 Fix timing on I/O benchmark 2010-09-25 18:19:50 +02:00
Ryan Dahl
3fc9192d0d Add function_call benchmark 2010-09-23 22:27:44 -07:00
Fedor Indutny
5535aa3d51 Fixed 'upgrade' event for httpclient
onend and ondata was cleaning on parser end
2010-09-23 10:29:20 -07:00
isaacs
4d0456f827 Don't use stat in fs.readFile[Sync]
Original patch c/o Evan Larkin <evan.larkin.iit@gmail.com>
2010-09-22 22:06:32 -07:00
Ryan Dahl
4df999f85f Revert "Upgrade V8 to 2.4.5"
This reverts commit e227441248.

Build fails on mac
2010-09-22 19:20:06 -07:00
Tj Holowaychuk
893ebe7230 Fixed fs.ReadStream() start: 0 bug 2010-09-22 10:22:43 -07:00
Ryan Dahl
e227441248 Upgrade V8 to 2.4.5 2010-09-22 10:21:15 -07:00
Mikeal Rogers
cc1d61cbb3 HTTP: close connection on connection:close header.
rnewson found a good bug in keep-alive. we were only using the request
headers we send to enable/disable keep-alive but when the server sends
Connection: close we need to close down the connection regardless.

I wrote up a patch the Robert verified makes all his test client code work
now and I also added a new unittest for it.
2010-09-22 10:17:07 -07:00
isaacs
dff1b5ad10 Don't try to run extension loaders unless they're actually functions 2010-09-22 10:13:25 -07:00
Ryan Dahl
9922e4e433 Don't choose jobs based on processor
Leads to lots of builds with out-of-memory.
2010-09-20 16:51:52 -07:00
Ryan Dahl
754fde7325 More explicit openssl configure warning 2010-09-20 12:52:07 -07:00
Ryan Dahl
1b1bee8099 Fix test/message/undefined_reference_in_new_context 2010-09-20 10:03:50 -07:00
Tim-Smart
0f16af7ee4 Remove registerExtension, add .extensions. Tests.
Updated extensions tests
2010-09-20 09:56:43 -07:00
Jorge Chamorro Bieling
fc334b3a97 sys.js: --needless Object.keys() --needless .map() in a single patch 2010-09-19 18:02:27 -07:00
Ryan Dahl
354150f4e1 Tag release versions in 'process.version' 2010-09-19 17:22:18 -07:00
isaacs
bb08f0c219 Remove require.async
This patch removes require.async from nodejs.

1. It complicated the code unnecessarily.
2. Everyone uses sync require anyway.
3. It's got a lot of weird edge cases when mixed with sync require.
4. It is many months behind the commonjs spec anyhow.
2010-09-19 16:52:39 -07:00
Paul Querna
2d348bb985 Fatal error out if OpenSSL was not explicitly disabled, we just couldn't autodetect it. 2010-09-19 15:32:10 -07:00
Ryan Dahl
27af64ef46 Forgot to include node_main.cc 2010-09-19 14:25:13 -07:00
Jorge Chamorro Bieling
8e246acd0e sys.js: sys.inspect: show function names 2010-09-19 13:37:09 -07:00
Ryan Dahl
1e63cd69f8 Update TODO 2010-09-19 13:32:46 -07:00
Ryan Dahl
124fbedc2f Add node::Start()
first step towards building a libnode.a
2010-09-19 13:13:59 -07:00
Ryan Dahl
db73c71280 Pass correct message in HTTP client upgrade
Simplify and correct test.

Fix by Fedor Indutny.
2010-09-19 11:55:18 -07:00
Ryan Dahl
4962702e4a Revert requireNative changes: 4e6b9b0, d429033, 6abbfa0, bcad540
The REPL needs the full require(); add test for that behavior.
2010-09-19 11:22:15 -07:00
Ryan Dahl
776754c33f Remove process._byteLength 2010-09-17 01:06:44 -07:00
Ryan Dahl
9628e28aec Remove process.evalcx 2010-09-17 00:23:27 -07:00
Ryan Dahl
01b3418e2e Move IOWatcher and Timer to process.binding 2010-09-17 00:15:54 -07:00
Ryan Dahl
5a801d63d1 Finally remove process.unloop 2010-09-17 00:03:17 -07:00
Ryan Dahl
f8ce848d9b Remove process.global 2010-09-17 00:01:27 -07:00
Ryan Dahl
31f8fa222e Add require('constants') 2010-09-16 23:22:58 -07:00
Ryan Dahl
6680c7fbf7 Add TODO item 2010-09-16 23:16:36 -07:00
Ryan Dahl
6eca948ca2 Move constants out of process object 2010-09-16 23:16:07 -07:00
Ryan Dahl
3def66ac3b Add items to TODO 2010-09-16 22:22:38 -07:00
Ryan Dahl
431e43009c Upgrade V8 to 2.4.4 2010-09-16 21:33:32 -07:00
Ryan Dahl
d2de8ba400 ^c to get out of '...' in REPL 2010-09-16 21:07:22 -07:00
Ryan Dahl
42eb5a6898 Simplify REPL 2010-09-16 20:50:56 -07:00
Ryan Dahl
bbbcd1fee0 Safe constructors for fs.ReadStream and fs.WriteStream 2010-09-16 19:04:09 -07:00
Ryan Dahl
6da0593162 Remove old versions of fs.read and fs.write from docs 2010-09-16 18:51:50 -07:00
Paul Querna
5a00d9d50f Use the Apple recommended way of detecting OSX Versions
to enable KQueue, rather than deciding based on the compiler version.
2010-09-16 17:32:30 -07:00
Paul Querna
c8f9728de7 Move dns.isIP to net.isIP
Add tests and docs.
2010-09-16 17:27:10 -07:00
Ryan Dahl
251d03197f Remove deprecation warnings in net module 2010-09-16 15:02:12 -07:00
Ryan Dahl
a63fd0fe56 Remove deprecation warnings in http module 2010-09-16 14:49:12 -07:00
Ryan Dahl
f08985c193 Handle writeStream errors in sys.pump 2010-09-16 14:40:41 -07:00
Herbert Vojčík
3e0a8f3ad8 Common subexpression in emit. 2010-09-16 13:47:43 -07:00
Herbert Vojčík
4e6b9b0992 No need to do if (internalModuleCache...), it's in requireNative. 2010-09-16 13:46:27 -07:00
Herbert Vojčík
d429033fd7 Module system moved to the bottom, where only is it needed.
(this also splits the file into upper "setup" and lower "startup" sections)
2010-09-16 13:45:43 -07:00
Herbert Vojčík
6abbfa09ff m.id unneccessary, id is enough. 2010-09-16 13:44:16 -07:00
Herbert Vojčík
bcad5403d6 Natives having their own self-contained minimalistic module system.
The main system is built upon this, and is optional, if only natives
are used in application (eg. node-core).

Natives not loaded into own context if NODE_MODULE_CONTEXTS=1.
This have its inner logic, if natives are seen just as lazy-loaded
parts of the core.
2010-09-15 17:30:34 -07:00
Ryan Dahl
f47ad10db7 Remove a few old deprecation warnings 2010-09-15 16:18:54 -07:00
Sam Stephenson
6560ab9073 Send multiple header lines in ServerResponse#writeHead when header values are arrays 2010-09-15 15:55:30 -07:00
Ryan Dahl
6bdc42cee7 shorten some lines in events.js 2010-09-15 15:47:28 -07:00
Ryan Dahl
ae8f8e7258 Optimize emit for two arguments 2010-09-15 15:20:04 -07:00
Ryan Dahl
feea1330cc Make a list of known globals
And fix missing var!

It would be good to get this script running at the end of every test, so we
know that modules aren't leaking either - but it will require a lot
modification of the tests so that they themselves aren't leaking globals.
2010-09-14 23:03:29 -07:00
Ryan Dahl
77fc61d539 Default value for second arg of Buffer#slice 2010-09-14 15:39:27 -07:00
Mark Nottingham
4fe3007a1a Support for outgoing HTTP trailing headers 2010-09-14 15:20:45 -07:00
Ryan Dahl
83ff473d30 Use child_process.exec rather than sys.exec 2010-09-14 10:29:56 -07:00
isaacs
686d9f9cc6 Bug in realpath with symlinks to absolute folder paths which have children.
Found by Cliffano Subagio
http://groups.google.com/group/nodejs/browse_thread/thread/f46f093938265ac0/387e14da08c7dd7b?
2010-09-14 10:27:57 -07:00
Ryan Dahl
61448bfc4e Upgrade libeio 2010-09-13 15:40:20 -07:00
Peter Griess
422d3c93bc Get rid of PHP/Rails style parameter munging.
- Handle only the most basic of query string parsing and construction.
  Leave the rest (e.g. Rails/PHP behaviors) to modules higher up the
  stack, like Express.
2010-09-13 12:39:30 -07:00
Tony Metzidis
debf389490 Catch Exceptions thrown when openssl is disabled 2010-09-13 12:04:31 -07:00
Tony Metzidis
5c9b9c2e70 - fix AttributeError on "use_openssl" when doing ./configure --without-ssl - error was: AttributeError: Values instance has no attribute 'use_openssl' 2010-09-13 11:50:06 -07:00
Ryan Dahl
efdd73c8e4 Fix style in node_object_wrap.h 2010-09-13 11:40:04 -07:00
Ryan Dahl
aef0d8086b Add lfs flags to node addon script 2010-09-12 21:58:18 -07:00
Ryan Dahl
2d09ef8541 Fix style in readline 2010-09-12 21:47:56 -07:00
Ryan Dahl
0ef8a86af2 Add SIGWINCH handler for readline 2010-09-12 21:23:53 -07:00
Ryan Dahl
678fa31136 add to todo 2010-09-11 20:40:46 -07:00
Paul Querna
9a701b0a70 Expose fingerproint from getPeerCertificate
Expose the SHA1 digest of the certificate as the fingerprint attribute in
the object returned by getPeerCertificate()
2010-09-09 23:35:17 -07:00
Ryan Dahl
3a9570386a Fix fs.realpathSync('/') 2010-09-09 18:49:28 -07:00
isaacs
85fb47c11c Better temporary directory handling for tests.
Add a setUp and tearDown function to the test case class, and use it to
create and remove the test/tmp directory for each test.

TODO: amend other tests.
2010-09-09 16:43:18 -07:00
Ryan Dahl
7628905a9b Don't use empty.js - breaks module test 2010-09-09 16:22:57 -07:00
Felix Geisendörfer
f870240dcf Simple benchmark for node's startup time 2010-09-09 15:51:17 -07:00
Ryan Dahl
5d42cc3a44 Use SetPointerInInternalField 2010-09-09 15:47:37 -07:00
Ryan Dahl
98683d285c Merge branch 'fast-buffer' 2010-09-09 11:08:16 -07:00
Ryan Dahl
b8bfbdab48 Rename SlowBuffer in binding 2010-09-09 11:03:51 -07:00
Ryan Dahl
5bc4efe820 Remove blobs, simplify SlowBuffer
Implement SlowBuffer.prototype.slice in js
2010-09-09 11:03:51 -07:00
Ryan Dahl
380d12832c Remove dead code 2010-09-09 11:03:50 -07:00
Ryan Dahl
efc723787a Fix big string bug 2010-09-09 11:03:50 -07:00
Ryan Dahl
71d67dbf48 Remove fancy SlowBuffer constructor 2010-09-09 11:03:50 -07:00
Ryan Dahl
ba2e4a2306 Simplify fast buffer constructor 2010-09-09 11:03:50 -07:00
Ryan Dahl
3e9f636b64 Improve long buffer test 2010-09-09 11:03:50 -07:00
Ryan Dahl
8078ed1f86 Expose fast-buffer bug in tests 2010-09-09 11:03:50 -07:00
Ryan Dahl
ff027d571b Update fast buffer benchmarks 2010-09-09 11:03:50 -07:00
Ryan Dahl
17ba821e60 defineProperty is slow, don't use it for fastbuffer 2010-09-09 11:03:50 -07:00
Ryan Dahl
d3fcd1c75a Expose SlowBuffer 2010-09-09 11:03:50 -07:00
Ryan Dahl
6135941eea Fix ByteLength hangup 2010-09-09 11:03:50 -07:00
Ryan Dahl
8b4f1e05f9 Expose Buffer.poolSize 2010-09-09 11:03:50 -07:00
Ryan Dahl
5da4faf8c7 fast buffers for crypto 2010-09-09 11:03:49 -07:00
Ryan Dahl
5f935f6c14 Fast buffers for http-parser 2010-09-09 11:03:49 -07:00
Ryan Dahl
5506f99dfa map charsWritten to fast buffer 2010-09-09 11:03:49 -07:00
Ryan Dahl
ececd92f62 Fix base64 write for buffers 2010-09-09 11:03:49 -07:00
Ryan Dahl
1f947f7b41 remove unnecessary casts 2010-09-09 11:03:49 -07:00
Ryan Dahl
7b772f3f68 More fast buffer work 2010-09-09 11:03:48 -07:00
Ryan Dahl
d5bdda74c1 fast buffer bounds checking in copy() 2010-09-09 11:03:48 -07:00
Tim-Smart
6ea99721f1 string.length !== Buffer.byteLength(string) 2010-09-09 11:03:48 -07:00
Ryan Dahl
1cf538a60a Work to get C++ fast buffers. incomplete 2010-09-09 11:03:48 -07:00
Ryan Dahl
2dda6be799 Fast Buffer safe constructor 2010-09-09 11:03:48 -07:00
Ryan Dahl
565d862f3c Fix buffer binding 2010-09-09 11:03:48 -07:00
Ryan Dahl
b87669cbf4 Fix fastbuffer style
Fix style
2010-09-09 11:03:48 -07:00
Tim-Smart
2b07c9fcae Some silly fixes to buffer.js 2010-09-09 11:03:47 -07:00
Tim-Smart
746d487da8 FastBuffer implementation. API needs migration 2010-09-09 11:03:47 -07:00
Felix Geisendörfer
ef54777fa5 Fix: uncaughtException was broken for main module
See: 635986e433
2010-09-09 10:47:30 -07:00
Ryan Dahl
17f3ffa633 Call Tick() after coming out of select()
Previously we would only call it before going into select(). This is needed
to fix test/simple/test-next-tick-ordering2.js.
2010-09-09 10:30:43 -07:00
isaacs
ba0c32e2e1 Fix issue #262. Allow fs.realpath to traverse above the current working directory. 2010-09-08 17:35:58 -07:00
Ryan Dahl
9a6d2c35a1 V8 Cygwin patch 2010-09-08 17:16:18 -07:00
Ryan Dahl
8796ed2278 Upgrade V8 to 2.4.2 2010-09-08 17:14:42 -07:00
Tobie Langel
512016fd74 Test for ReadStream typo 2010-09-08 12:09:13 -07:00
Ryan Dahl
0e501f4ec5 Fix style; undefined reference bug 2010-09-08 12:03:33 -07:00
Tobie Langel
ccf4afa256 Do not emit WriteStream's drain event before ws.write has been called. 2010-09-08 11:58:54 -07:00
Tobie Langel
f5e4047064 Avoid closing a WriteStream before it has been opened. 2010-09-08 11:51:29 -07:00
Tobie Langel
75f922c863 Avoid missing ref error in WriteStream.prototype.destroy(). 2010-09-08 11:50:56 -07:00
Herbert Vojčík
71651bf8b2 Make test-global work with NODE_MODULE_CONTEXTS. 2010-09-08 10:40:55 -07:00
Herbert Vojčík
6789ab16d8 Modifying test-global to accomodate v8 inter-context 'global' protection. 2010-09-08 10:37:26 -07:00
Herbert Vojčík
2a03d5802b Removing test-global-between-modules.
Using "global" to push data to require()d modules
not supported under NODE_MODULE_CONTEXTS=1.
2010-09-08 10:36:45 -07:00
Herbert Vojčík
8718fa54f6 Removed comment-out code. 2010-09-08 10:34:47 -07:00
Ryan Dahl
24ac87f543 Increase ReadStream bufferSize to 64k 2010-09-08 10:14:04 -07:00
Trent Mick
1d961a6630 add ANSI coloring option to sys.inspect and, by default, to the repl 2010-09-08 09:47:13 -07:00
Trent Mick
5330fea954 Ctrl+W support for the REPL
FWIW, command-line style (delete back to whitespace) would be:
    leading = leading.replace(/\S+\s*$/, '');
2010-09-08 09:45:57 -07:00
Felix Geisendörfer
cf4b5fc52a Test case showing a bug in nextTick ordering
nextTick should fire before setTimeout in this test, but it doesn't.
2010-09-07 22:37:14 -07:00
Ryan Dahl
1d0fb850d9 test-http-parser should not use private API 2010-09-07 17:17:12 -07:00
Ryan Dahl
4fe5e86a7e Don't refer to private API in test-repl 2010-09-07 17:16:24 -07:00
Ryan Dahl
1be722a271 Special deepEquals for buffer 2010-09-07 17:14:04 -07:00
Ryan Dahl
3c00ec4e48 typo: forceClose -> destroy for WriteStreams 2010-09-05 02:27:02 -07:00
Benjamin Thomas
cda1a38426 Fix bug in process._tickCallback where callbacks can get abandoned.
Change process._tickCallback so that if a callback throws an error but
there are other callbacks after it, we indicate that
process._tickCallback needs to be ran again.

Currently, if a callback in process._tickCallback throws an error, and
that error is caught by an uncaughtException handler and
process.nextTick is never called again, then any other callbacks already
added to the nextTickQueue won't be called again.

Updated the next-tick-errors test to catch this scenario.
2010-09-02 09:24:39 -07:00
isaacs
0e311717b5 Treat "//some_path" as pathname rather than hostname by default.
Note that "//" is still a special indicator for the hostname, and this does
not change the parsing of mailto: and other "slashless" url schemes.  It
does however remove some oddness in url.parse(req.url) which is the most
common use-case for the url.parse function.
2010-09-02 09:24:21 -07:00
Ryan Dahl
7347fb3e2c Make sure setInterval(cb, 0) loops infinitely 2010-08-31 16:45:17 -07:00
Ryan Dahl
5be6ab6cdb Fix style 2010-08-30 16:35:58 -07:00
Ryan Dahl
a055153cda Fix style in test/simple/test-dgram-unix.js 2010-08-30 14:17:27 -07:00
Ryan Dahl
f188b9d6d7 Remove timer from test/simple/test-dgram-unix.js
Test running already has a timeout mechanism.
2010-08-30 14:15:30 -07:00
Marco Rogers
af9aa93e0c fix for fs.readFile to return string when encoding specified on zero length read 2010-08-30 14:08:18 -07:00
Marco Rogers
9c7c6e93e1 Fixed async fs writes with length 0, it should fire the callback 2010-08-30 13:58:50 -07:00
Bradley Meck
d5214b3627 Allow Strings for ports on net.Server.listen 2010-08-30 13:27:38 -07:00
Fedor Indutny
db23af05b0 Constants should be readOnly and DontDelete 2010-08-30 12:13:41 -07:00
Ryan Dahl
635986e433 Add failing uncaughtException test
FIXME
2010-08-30 12:02:22 -07:00
Johan Euphrosine
e49be4768b add readline support for meta-d 2010-08-30 10:26:51 -07:00
Russell Haering
37b6e10684 Pass an error to the sys.pump callback if one occurs
- Add test case for pumping from unreadable stream.
- Document the sys.pump error handling behavior
2010-08-30 10:23:48 -07:00
Benjamin Thomas
57642e2349 Fix process.nextTick so thrown errors don't confuse it.
If the function for a process.nextTick throws an error, then the
splice() never removes that function from the nextTickQueue array.  This
makes sure the functions that have been run in _tickCallback get removed
regardless of errors.

Also add a test for this.
2010-08-27 22:13:50 -07:00
Ryan Dahl
4fdebab005 Safe constructor: net.Server, net.Stream 2010-08-27 15:38:46 -07:00
Ryan Dahl
f86ad1693f Safe Constructor: Buffer 2010-08-27 15:23:51 -07:00
Ryan Dahl
44a287987e Safe constructors: http.Server and http.Client 2010-08-27 13:58:52 -07:00
Ryan Dahl
e8b3751743 Only check for execinfo lib in freebsd
OpenEmbedded doesn't like it when you look in /usr/lib
2010-08-27 06:20:20 -07:00
Johan Euphrosine
51224f12ca add test for readline putty support 2010-08-23 10:25:55 -07:00
Brian
d9eb64928e Fix home/end keys in repl for putty/xterm. 2010-08-23 09:18:36 -07:00
Russell Haering
6078c37be5 Modify fs.open to use accept a callback without a mode 2010-08-23 02:42:25 -07:00
Johan Euphrosine
748469c71c add readline support for meta-f and meta-b 2010-08-23 01:47:41 -07:00
Johan Euphrosine
fd3e84499e add home/end support in rxvt and readline tests 2010-08-23 01:46:14 -07:00
Felix Geisendörfer
c209e57e50 Document WriteStream 'open' event 2010-08-23 01:44:44 -07:00
isaacs
072750e662 Add testing items, and make npm lowercase 2010-08-22 20:25:06 -07:00
isaacs
e55c486801 Missing 'var' in sys.inspect (Found by Oleg Slobodskoi) 2010-08-22 13:45:39 -07:00
Aria Stewart
8ec21059dd Fix doc.js so that it doesn't misnest menu items in the TOC 2010-08-22 13:10:18 -07:00
Johan Euphrosine
0e1e00e68b fix home/end on GNU/Linux 2010-08-22 12:34:58 -07:00
Johan Euphrosine
bedca2e7a9 add tests for console.log arguments handling 2010-08-22 12:34:00 -07:00
Aria Stewart
a834d93d2c s/HTTPS/SSL/ where appropriate 2010-08-22 12:31:58 -07:00
Ryan Dahl
2982e75a0b set-cookies header is an array of values. always 2010-08-21 16:34:38 -07:00
Ryan Dahl
488aff085b Improve appendix markdown 2010-08-21 01:24:14 -07:00
Ryan Dahl
33e919ae6f Add appendix to docs 2010-08-21 00:30:18 -07:00
Ryan Dahl
7fc794a8ec Fix default encoding in docs 2010-08-20 08:49:20 -07:00
Ryan Dahl
4fcbc1b64a Update make website-upload 2010-08-20 02:00:37 -07:00
Ryan Dahl
9283e134e5 bump version 2010-08-20 01:53:08 -07:00
Ryan Dahl
51ecba8da9 Add get/set methods to Buffer 2010-08-19 23:29:06 -07:00
Ryan Dahl
0c20c588af Remove YAWS vs Apache benchmark
http://twitter.com/bascule/status/21626934378
2010-08-19 19:25:00 -07:00
Tim Caswell
81a53e83ab Make process.nextTick worlds faster for large queues. 2010-08-19 19:19:18 -07:00
Ryan Dahl
60b93cca6d Fix race conditions in test-dgram-multicast.js 2010-08-19 18:49:27 -07:00
Ryan Dahl
12a169e8ff Add buffer_creation benchmark 2010-08-19 01:40:28 -07:00
Trent Mick
293809b8b6 drop obsolete TODO comment 2010-08-18 23:02:54 -07:00
Trent Mick
1aeaf8d289 repl tab completion: insert common prefix of multiple completions 2010-08-18 23:02:30 -07:00
Trent Mick
5c1ffa165f repl completion: completion for arguments to "require" 2010-08-18 22:59:49 -07:00
Trent Mick
2134982ea4 repl completion: comment/TODO cleanup, no functional change 2010-08-18 22:59:35 -07:00
Herbert Vojčík
c5eb1b55d9 Making "root" available in both context and non-context mode. 2010-08-18 22:50:55 -07:00
Ryan Dahl
0906f945be Fix V8 build for old gcc
also sent upstream: http://codereview.chromium.org/3130033/show
2010-08-18 22:50:16 -07:00
Herbert Vojčík
28b21d15c3 Fix undefined_reference_in_new_context test for own-context module loader. 2010-08-18 14:06:30 -07:00
Ryan Dahl
5bce8ed118 Fix process.platform 2010-08-18 13:16:32 -07:00
Herbert Vojčík
2b126da395 Tests for behaviour of 'global'. 2010-08-18 12:08:39 -07:00
Herbert Vojčík
5dc2b93311 Fix sys.inspect for regex in different context. 2010-08-18 11:47:43 -07:00
Herbert Vojčík
9253333850 Fix registerExtension for NODE_MODULE_CONTEXTS
Fix of registerExtension-produced non-string module loading with own
context. Plus finishing touches to the test.
2010-08-18 11:46:37 -07:00
Ryan Dahl
39b432e42a Add process.versions 2010-08-17 11:25:42 -07:00
Ryan Dahl
41ad33910f Add Paul Querna's io benchmarks 2010-08-17 08:43:26 -07:00
Herbert Vojčík
cf2b206a8e More changes to tests so they really work under context module loader.
Plus, getting rid of test/common.js defining things in global.
2010-08-17 08:41:05 -07:00
Herbert Vojčík
1872719b8c Typo in comment. 2010-08-17 08:38:44 -07:00
Ryan Dahl
91757fa840 Upgrade V8 to 2.3.8 2010-08-17 08:37:25 -07:00
Ryan Dahl
d4f4380f7e Add TODO 2010-08-17 08:16:43 -07:00
Ryan Dahl
03dda31b75 Simplify loading events.js 2010-08-17 08:15:46 -07:00
Herbert Vojčík
32e309440f Fix of 'sys.common.debug' calls in tests. 2010-08-17 08:08:36 -07:00
Marco Rogers
6744e59e46 detect 0 length fs writes with tests 2010-08-16 23:57:01 -07:00
Herbert Vojčík
4db608dbba Get away uint/int comparision warning. 2010-08-16 15:17:17 -07:00
Ryan Dahl
ae5d613b3e Add --without-snapshot configure option 2010-08-15 14:27:05 -07:00
Ryan Dahl
4593c04959 Implement net.Server.maxConnections
Simplify EMFILE behavior.
2010-08-15 14:01:55 -07:00
Illarionov Oleg
cde80d9859 Fix OpenSSL 100% CPU usage on error 2010-08-15 13:23:09 -07:00
Herbert Vojčík
ff953dccf1 Refactor of resolveModulePath to make it clearer. 2010-08-15 11:12:48 -07:00
Herbert Vojčík
13a3bf5b7d Clean up findModulePath
Separating "what to traverse" from "how to traverse and what to do with it "
in findModulePath.  It may also fix one not-yet-found bug (absolute ids
weren't loaded when dirs.length = 0).
2010-08-15 11:06:36 -07:00
Herbert Vojčík
361759d179 Using Array.isArray for Array testing in findModulePath. 2010-08-15 11:05:48 -07:00
Ryan Dahl
1b589be1d6 Remove TODO item 2010-08-14 14:23:09 -07:00
Vanilla Hsu
49cd211dff Add freebsd's process.title support. 2010-08-13 22:29:38 -07:00
Ryan Dahl
b14dd49222 bump version 2010-08-13 09:02:10 -07:00
Ryan Dahl
a8c2bb41af Fix tests 2010-08-13 08:55:42 -07:00
Ryan Dahl
03123435e0 Remove platform specific asserts 2010-08-13 08:13:54 -07:00
Ryan Dahl
4bbab14346 Revert "Upgrade V8 to 2.3.7"
This reverts commit 083ee0f8b7.

V8 build broken on cygwin:
  ./deps/v8/src/handles.h:62: instantiated from `T*
  v8::internal::Handle<T>::operator->() const [with T = v8::internal::Code]'
  ./deps/v8/src/accessors.cc:396: instantiated from here
  ./deps/v8/src/handles-inl.h:50:
  error: call of overloaded `BitCast(v8::internal::Code** const&)' is
  ambiguous
  ./deps/v8/src/utils.h:732: note: candidates are: Dest
  v8::internal::BitCast(const Source&) [with Dest = v8::internal::Code**,
  Source = v8::internal::Code**]
  ./deps/v8/src/utils.h:743:
  note:                 Dest v8::internal::BitCast(Source* const&) [with Dest
  = v8::internal::Code**, Source = v8::internal::Code*]
  scons: *** [obj/release/accessors.o] Error 1
2010-08-13 07:43:53 -07:00
Bert Belder
0e8d858aba One more test with a race condition fixed 2010-08-13 07:18:38 -07:00
Bert Belder
d8642a8aa6 Implement process.title for cygwin 2010-08-13 07:01:32 -07:00
Rasmus Andersson
cf909e8725 added dns.getHostByAddr() -- resolve an external IP address to hostname(s) 2010-08-12 16:25:45 -07:00
Rasmus Andersson
758f12f34c added read and write support for process.title Darwin
This will only manipulate the OS X-level process name, not the title shown
in e.g. ps.
2010-08-12 16:23:41 -07:00
Ryan Dahl
083ee0f8b7 Upgrade V8 to 2.3.7 2010-08-12 10:11:03 -07:00
Ryan Dahl
9acd76ed6e Don't throw on HEAD requests 2010-08-12 10:06:52 -07:00
Trent Mick
72e4a49cac repl completion: multi-column display of completions 2010-08-12 00:07:26 -07:00
Rasmus Andersson
8d5e05668b Added support for multiple listeners to DNS multicast datagrams.
Some platforms require SO_REUSEPORT to be set for the socket.
2010-08-11 19:02:20 -07:00
Bert Belder
7059be19ec Fix http and net tests failing due to race condition
Plus some minor cosmetic corrections
2010-08-11 17:27:44 -07:00
Trent Mick
1c9a85b9a6 First pass at tab-completion in the REPL 2010-08-11 13:42:45 -07:00
Ryan Dahl
06634f48eb Implement process.title for linux 2010-08-11 13:15:00 -07:00
Ryan Dahl
5185c15ef7 Stub out process.title 2010-08-11 12:39:42 -07:00
Fedor Indutny
49888a01c3 Cygwin: process.execPath fix 2010-08-11 11:44:51 -07:00
Ryan Dahl
883b3e2873 Remove -Werror from v8 SConstruct 2010-08-11 00:23:12 -07:00
Rasmus Andersson
fd3cd755d1 [dgram] only look up hostname for the requested address family
- [lib/dns.js] dns.lookup takes a new optional argument "family" which
  should be the integer 4, 6, dns.AF_INET or dns.AF_INET6. Passing a
  non-false "family" argument makes c-ares explicitly look up addresses for
  the specified family.

- [test/simple/test-c-ares.js] test explicit address family lookups
2010-08-10 17:53:32 -07:00
Ryan Dahl
9395786d11 Fix race conditions in tests 2010-08-10 17:48:37 -07:00
Ryan Dahl
3d551e5538 Close fd on readFile(emptyfile) 2010-08-10 14:47:40 -07:00
Ryan Dahl
a5be730906 Upgrade V8 to 2.3.6 2010-08-10 09:17:11 -07:00
Ryan Dahl
1c5d5e0b72 uppercase request methods 2010-08-09 21:23:52 -07:00
Bert Belder
7d4e8a9a71 If no options are given to child_process.spawn, env should default to process.env
Regression.
2010-08-09 15:37:14 -07:00
Ryan Dahl
f4f05a8851 Unset CLOEXEC on spawn's customFds 2010-08-09 15:33:57 -07:00
Rasmus Andersson
e07f568230 ignore test/fixtures/hello.txt created by some test(s) 2010-08-09 13:15:28 -07:00
Brian
3aa5cfde10 Misc. corrections and consistency changes to documentation. 2010-08-09 09:08:08 -07:00
Ryan Dahl
5033da733d Add TODO list items 2010-08-08 13:37:51 -07:00
Ryan Dahl
cf5ae13f85 Remove completed TODO task 2010-08-08 12:13:20 -07:00
Ryan Dahl
7068912fbb Export Interface from readline.js 2010-08-08 11:52:31 -07:00
Trent Mick
e8c2453f6d spelling correction 2010-08-06 14:48:38 -07:00
Bert Belder
aaa1f451e6 Expose cwd option to child_process.exec() 2010-08-06 13:38:41 -07:00
Bert Belder
94914135df New api for child_process.spawn; ability to set cwd for spawn()ed process
Tests for child_process.spawn() use new API

Test for deprecated child_process.spawn() API
2010-08-06 13:37:30 -07:00
Ryan Dahl
d408de87fc Remove module.js - put code into src/node.js 2010-08-06 12:34:02 -07:00
Tj Holowaychuk
e8795cea30 Added console.trace() 2010-08-06 12:15:04 -07:00
Tj Holowaychuk
a8e1e8d057 Added console.{time,timeEnd}() 2010-08-06 12:11:04 -07:00
Tj Holowaychuk
e15221a8de console formatter appends extra arguments
This makes the console methods more "browser-like",
for example:

  console.log("foo", "bar", "baz");
  // foo bar baz

but still works with formatting

  console.log("hey %s", "tj", "whats up");

  // hey tj whats up
2010-08-06 12:10:08 -07:00
cloudhead
fe3e419687 querystring.parse: handle undefined value properly 2010-08-05 10:46:28 -07:00
Felix Geisendörfer
ffbbc465d3 Support inspecting objects with console.log
If the first parameter passed into console.log() is not a string, all
parameters will be printed as formated by sys.inspect. This change
also affects console.info and console.warn.
2010-08-05 10:23:17 -07:00
Ryan Dahl
6cd32fb62e Update AUTHORS 2010-08-04 16:50:59 -07:00
Ryan Dahl
a4906c7c83 Print warning when OpenSSL not found 2010-08-04 16:07:10 -07:00
Nick Stenning
0a3eff8021 Standardise module load order for native and registered file extensions.
This patch standardises the load order for modules. Highest priority is trying to load exactly the file the user specified, followed by native extensions, followed by registered extra extensions, etc.

In full, if we require('foo') having registered '.coffee' as an alternative extension, we try and load the following files in order:

    foo
    foo.js
    foo.node
    foo.coffee
    foo/index.js
    foo/index.node
    foo/index.coffee
2010-08-04 16:03:08 -07:00
Nick Stenning
78520ba482 Don't attempt to load a directory.
This patch replaces the path.exists check for module loading with a call to
fs.statSync (or fs.stat for require.async) which ensures that it's not trying
to load a directory.
2010-08-04 15:55:47 -07:00
Ryan Dahl
0b925d075d bump version 2010-08-04 12:04:12 -07:00
Ryan Dahl
81f5ed5c65 Upgrade V8 to 2.3.5 2010-08-04 11:46:42 -07:00
Ryan Dahl
7db5c8a10d Fix toString('base64') bug
Thanks to Stepan Stolyarov for the test case.
2010-08-04 11:38:48 -07:00
Samuel Shull
24c6d26cca Add node_version.h to install 2010-08-04 10:54:02 -07:00
Ryan Dahl
adec544fdd Revert "Expose the V8 debug object process.debug"
This reverts commit d9fbb8a580.
2010-08-04 10:38:19 -07:00
Ryan Dahl
31b59400f8 Allow null context in Script 2010-08-04 10:20:40 -07:00
isaacs
1a1214866f SetBlocking should set blocking, not toggle it 2010-08-04 09:58:56 -07:00
isaacs
e9aacd40c6 When the parent's stdio FDs are passed to a child, make them temporarily blocking.
Many programs do not handle non-blocking stdio very well.  In particular,
man and less have serious problems with this, and since stdout isn't being
flushed after each write, the output jumps about on the screen as you page
down.  Programs that do use non-blocking stdio will set that flag themselves
(as node does).

This puts the stdio file descriptors into blocking mode before sharing them
with the child process, so that one could spawn a vim subprocess, or some
other program that depends on blocking IO.
2010-08-03 18:11:43 -07:00
Ryan Dahl
a6bc68a83b Upgrade V8 to 2.3.4 2010-08-03 10:33:16 -07:00
Ben Noordhuis
4b19bd2896 Client.onend: Anticipate that the HTTP parser object is uninitialized when the client setup failed. 2010-08-02 11:25:53 -07:00
Ryan Dahl
d9fbb8a580 Expose the V8 debug object process.debug
Add one duplicate test from V8, just to make sure it works.
2010-08-02 00:46:09 -07:00
Mikeal Rogers
3214116be6 Implement keep-alive for http.Client
Send the 'Connection: keep-alive' header in your request to enable.
2010-08-01 22:34:17 -07:00
Brian
71009ad3fe Allow signals to be used with process.on in addition to process.addListener. 2010-08-01 20:23:03 -07:00
isaacs
65037eeb32 Don't let path.normalize get above the root.
Any path.join or path.normalize that starts with a / will not go "above" that after normalization.  This is important because /../foo is almost *always* some sort of error, and doesn't match the corollary in sh: `cd $p; pwd`

At the worse, this can be a vector for exploits, since a static file server might do path.join(docroot, path.normalize("/"+req)) to get the file.  If the normalized request path could be something like "/../../../etc/passwd" then bad things could happen.
2010-08-01 20:20:17 -07:00
Danny Coates
dc8c079d90 remove node::CheckBreak in favor of using the v8 debugger js object 2010-08-01 20:04:31 -07:00
Ryan Dahl
e59b3f0eb3 Upgrade http-parser for clang compat 2010-07-31 14:32:59 -07:00
Ryan Dahl
b2a2bb736b [v8] Remove global.print from v8natives.js (fixes issue 791)
Review URL: http://codereview.chromium.org/3045016
2010-07-30 12:20:32 -07:00
Ryan Dahl
c38dd24dc5 Fix style 2010-07-30 10:54:43 -07:00
Ben Noordhuis
f72ac17c89 Buffer: graciously handle padding in base64-encoded input. 2010-07-30 10:49:00 -07:00
Ryan Dahl
cf49fc7bfe Fix email address in AUTHORS file 2010-07-30 09:42:36 -07:00
Ryan Dahl
f291fbc8a7 Fix ending \0 in base64 decoding 2010-07-29 14:52:40 -07:00
Ben Noordhuis
95638c9b0d Buffer: adjust buffer size so the base64-decoded input fits snugly.
Stops Valgrind from complaining about uninitialized memory access.
2010-07-28 11:37:23 -07:00
Ryan Dahl
b5b83b210b Fix --debug-brk; hacky solution 2010-07-27 20:36:58 -07:00
Ryan Dahl
505178d82b Add todos 2010-07-27 12:19:08 -07:00
Ryan Dahl
8052dd0022 Clarify string encoding docs 2010-07-27 12:16:48 -07:00
Ryan Dahl
5459e5c606 Globalize the Buffer object 2010-07-27 10:58:45 -07:00
Ryan Dahl
b3c0359b56 Only one line break before stacktrace 2010-07-26 19:08:21 -07:00
Ryan Dahl
d489555553 Use kqueue on recent macintosh builds 2010-07-26 19:07:31 -07:00
Matt Ranney
f7c5334195 Check for socket on Unix domain connect.
Change scope to context in REPL docs.
2010-07-26 19:02:15 -07:00
Ryan Dahl
23cf556c6c Upgrade http-parser
support for
- long messages
- spaces in header fields
2010-07-26 15:02:20 -07:00
Ryan Dahl
552cf28260 Upgrade V8 to 2.3.3 2010-07-26 14:26:42 -07:00
Benjamin Kramer
eeaf1ef970 Constify read-only global data
Also silences a compiler warning about deprecated conversion from const
char* to char*.
2010-07-26 22:14:39 +02:00
Benjamin Kramer
93cb09642d Add missing parentheses
& has higher precedence than ==, making this a noop. Use the less
error-prone S_IS* macros instead. Found by clang.
2010-07-26 22:14:10 +02:00
Benjamin Kramer
eeb54c63d8 Fix addrlen for unix_dgram sockets
The old definition was off by one byte on BSD. Also simplify
ADDRESS_TO_JS because sun_path is always zero-terminated now.
2010-07-26 22:13:49 +02:00
Ryan Dahl
28db0c2562 Add write() callback TODO item 2010-07-26 12:42:59 -07:00
Chandra Sekar S
66deea10c7 Support for HOME and END in REPL. 2010-07-26 10:59:34 -07:00
Ryan Dahl
6fdb874e2e Fix DNS example in docs 2010-07-26 10:35:45 -07:00
Ryan Dahl
2a4568c85f bump version 2010-07-25 23:39:58 -07:00
Ryan Dahl
402bcb83bc Add reference to base64 encoding 2010-07-25 23:21:39 -07:00
Dmitry Baranovskiy
8ab3c3e7c3 Added ability to pass offset to buffer write and toString methods as a string, i.e. '2' and encoding as anything 2010-07-25 20:16:37 -07:00
Dmitry Baranovskiy
a585c5bbb3 Fixed format, so it wouldn’t blow up if %d argument is null or undefined + ensure that numbers will be numbers 2010-07-25 20:14:12 -07:00
Ryan Dahl
2c1ca4078d Implement buffer.write for base64
There might be an off-by-one on the returned value.
2010-07-23 16:36:52 -07:00
Ryan Dahl
528015e0d8 Implement buffer.toString('base64') 2010-07-23 13:52:44 -07:00
Ryan Dahl
138593b156 Fix case in docs 2010-07-23 12:14:51 -07:00
isaacs
f0f247d7e5 Fix dirname so that dirname('/a/b/') -> '/a', like sh's does.
Before there was this comment:
  Can't strip trailing slashes since module.js incorrectly
  thinks dirname('/a/b/') should yield '/a/b' instead of '/a'.
But now, such thinking is corrected.
2010-07-23 09:08:49 -07:00
Andrew Naylor
e0d6f14b22 Buffer for Cipher, Decipher, Hmac, Sign and Verify 2010-07-23 09:08:30 -07:00
Ryan Dahl
cb97cdb256 Remove Werror from SConstruct 2010-07-21 12:43:19 -07:00
Ryan Dahl
e4eeaa7fbc Upgrade V8 to 2.3.2 2010-07-21 12:31:46 -07:00
Ryan Dahl
07ab34cd58 TODO items 2010-07-21 11:44:47 -07:00
Chandra Sekar S
f5f7cb9264 Support for reading byte ranges from files using fs.createReadStream. 2010-07-21 11:33:35 -07:00
Peter Griess
56f200af5d Fix Buffer.toString() on 0-length slices.
- Buffer.toString('ascii', 0, 0) incorrectly returns the entire contents
  of the buffer. Fix this.
- Provide similar behavior to Buffer.write() and Buffer.copy() when
  dealing with 0-length in valid and invalid byte ranges.
2010-07-20 15:38:10 -07:00
Sam Shull
8acea2693d Add parenthesis to NODE_VERSION_AT_LEAST 2010-07-20 12:41:39 -07:00
Robert Keizer
5ebf6049d0 Added process.binding('stdio').getRows() 2010-07-20 12:38:03 -07:00
isaacs
d75b63bc3c Support including modules that don't have an extension.
This way, require("/foo") will work if there is a "foo.js", or a file named
simply "foo" with no extension.
2010-07-20 10:26:24 -07:00
Ryan Dahl
7067a7155f Specify env differently in execFile
Callbacks should always be the last argument.
2010-07-19 20:08:35 -07:00
Brian
352b8c3ad5 Consistency changes in api docs 2010-07-19 14:18:55 -07:00
isaacs
49e0f14a2f Cache modules based on filename rather than ID
This is ever so slightly less efficient than caching based on ID, since the
filename has to be looked up before we can check the cache.  However, it's
the most minimal approach possible to get this change in place.  Since
require() is a blocking startup-time operation anyway, a bit of slowness is
not a huge problem.

A test involving require.paths modification and absolute loading. Here's the
gist of it.

Files: /p1/foo.js /p2/foo.js

  1. Add "/p1" to require.paths.
  2. foo1 = require("foo")
  3. assert foo1 === require("/p1/foo") (fail)
  4. Remove /p1 from require.paths.
  5. Add /p2 to require.paths.
  6. foo2 = require("foo")
  7. assert foo1 !== foo2 (fail)
  8. assert foo2 === require("/p2/foo") (fail)

It's an edge case, but it affects how dependencies are mapped by npm.
If your module requires foo-1.2.3, and my module requires foo-2.3.4,
then you should expect to have require("foo") give you foo-1.2.3, and
I should expect require("foo") to give me foo-2.3.4.  However, with
module ID based caching, if your code loads *first*, then your "foo"
is THE "foo", so I'll get your version instead of mine.

It hasn't yet been a problem, but only because there are so few
modules, and everyone pretty much uses the latest version all the
time.  But as things start to get to the 1.x and 2.x versions, it'll
be an issue, I'm sure.  Dependency hell isn't fun, so this is a way to
avoid it before it strikes.
2010-07-19 14:17:22 -07:00
Peter Griess
a9d8cac4b0 Document setuid/setgid sync resolution capability. 2010-07-19 11:47:25 -07:00
Micheil Smith
299671b731 querystring: Removing typecasting of numeric strings to numbers
The tests did not accurately test for a strict equality, meaning that the
number == to the string.
2010-07-19 11:07:08 -07:00
Jan Kassens
f18d9d8466 querystring.js: JSLint warnings fixed 2010-07-19 10:54:50 -07:00
Jan Kassens
c7e0c64506 querystring doc fix 2010-07-19 10:53:54 -07:00
Jan Kassens
bb2acd5e75 querystring.stringify is now more solid
* handles NaN and Infinity
* works with arrays from other contexts
2010-07-19 10:53:32 -07:00
Ryan Dahl
eda1edd07f Add todo item 2010-07-19 10:35:59 -07:00
Ryan Dahl
9a26946aaa Fix for issue #214 2010-07-19 10:32:56 -07:00
Benjamin Fritsch
0ed3532699 added test for Issue #214 2010-07-19 10:16:31 -07:00
Ryan Dahl
65f2e72d77 Fix style in readline 2010-07-19 10:16:20 -07:00
Jérémy Lal
0fd1656d63 Support DEL in the REPL. 2010-07-18 22:20:23 -07:00
Ryan Dahl
02746eddd6 Apple's SUN_LEN is broken, override 2010-07-17 23:26:58 -07:00
Ryan Dahl
341e41726f Set SO_REUSEADDR on all sockets 2010-07-17 23:10:38 -07:00
Ryan Dahl
11a784d6da Upgrade http-parser 2010-07-17 01:22:16 -07:00
Ryan Dahl
fa344d8514 Fix solaris build 2010-07-16 23:24:08 -07:00
Ryan Dahl
0174ceb6b2 bump version 2010-07-16 21:50:26 -07:00
Ryan Dahl
458bbb4687 fs.writeSync should return bytes written 2010-07-16 19:05:28 -07:00
Marco Rogers
1662c37c40 Fix console formatter to recognize json properly 2010-07-15 23:36:35 -07:00
Ryan Dahl
dcd41ca864 Upgrade V8 to 2.3.0 2010-07-15 18:52:48 -07:00
Сергей Крыжановский
078a48a97b added env to child_process.exec 2010-07-15 17:17:03 -07:00
Matt Ranney
98341daee2 Fix unix dgram socket address resolution on Linux. 2010-07-15 16:46:46 -07:00
Ryan Dahl
02729d4af7 instanceof Buffer to Buffer.isBuffer() 2010-07-15 15:58:35 -07:00
Ryan Dahl
6961bc568f More instanceof Array fixes 2010-07-15 14:37:56 -07:00
Ryan Dahl
bd05d83ae7 Update TODO 2010-07-15 14:21:35 -07:00
Ryan Dahl
c926ab7746 Fix test-executable-path.js
Now that process.version doesn't say if the build is debug or not.
2010-07-15 14:21:32 -07:00
Ryan Dahl
8921bf454d Remove race conditions and simplify test-http-exceptions.js 2010-07-15 14:21:32 -07:00
Ryan Dahl
4c6f4dabf5 Adjust tests for error reporting on JSON.parse(undefined)
The V8 upgrade changed the stacktrace reports (?)
2010-07-15 14:21:32 -07:00
Ryan Dahl
9fd5e3c89c Update tests to work with module contexts 2010-07-15 14:21:31 -07:00
Ryan Dahl
9472812569 Fix reference to root global context 2010-07-15 10:52:31 -07:00
Ryan Dahl
ddad872020 Add TODO list 2010-07-15 10:36:35 -07:00
Ryan Dahl
6a57a42109 Use Array.isArray instead of instanceof 2010-07-15 10:35:29 -07:00
Ryan Dahl
3a00470dbb Add 'root' global variable as reference to sandbox 2010-07-15 10:35:29 -07:00
Ryan Dahl
5f30377bbc Load modules in individual contexts
Add NODE_MODULE_CONTEXTS env var

Only one test was modified to check that this works. NEED to go through all
tests and modify them so that

  NODE_MODULE_CONTEXTS=1 make test

passes.
2010-07-15 10:34:39 -07:00
Matt Ranney
4e50197e53 Datagram socket refactor. Add tests and documentation.
Support setTTL() and setBroadcast() socket options.
2010-07-15 10:27:44 -07:00
Peter Griess
e7c4f8cdaa Buffer.copy() should liberally allow empty copies. 2010-07-15 10:20:42 -07:00
Peter Griess
b64a521d66 Buffer('') should create a 0-length buffer 2010-07-15 09:54:53 -07:00
Ryan Dahl
8e2530c320 Upgrade V8 to 2.2.24 2010-07-14 11:16:20 -07:00
Paul Querna
870aa3d97f Move evals to extension module. 2010-07-14 10:55:07 -07:00
Paul Querna
ace2be8aa6 Move the Stat structure functions to node_file.cc
from node.cc, so we can convert fs to a module.
2010-07-14 10:42:32 -07:00
Paul Querna
82daa46e26 Move Buffer to extension model. 2010-07-14 10:37:24 -07:00
Paul Querna
4f7f43762d Move child process to extension model. 2010-07-14 10:36:52 -07:00
Paul Querna
e65c27062f Move http parser to extension model. 2010-07-14 10:36:24 -07:00
Paul Querna
e51aef7f3c Move signal_watcher to extension model. 2010-07-14 10:31:45 -07:00
Paul Querna
208290b524 Move cares to extension model 2010-07-14 10:31:20 -07:00
Paul Querna
e5bb8abc9d Move stdio to extension model. 2010-07-14 10:29:56 -07:00
Paul Querna
8dbfe5ea8f Use the top level check for the bindings cache
(rather than each potential module having its own if check)
2010-07-14 10:23:24 -07:00
Paul Querna
30dadfc033 Register builtin extensions via a macro, rather than a manual strcmp
Set the stage for making the builtin modules more dynamic.

Note: this only converts crypto and net, I will add more extensions in a
later commit.

* node.h: Add utility macro for converting macro values to strings.

* node.h: Include the actual module name inside the module structure, not
  just the file it was built from.

* node.h: New Macro, NODE_MODULE_DECL, for declaring an external reference
  to a module structure.

* node_extensions.cc: New File, implements get_builtin_module, which
  iterates over the module structures that are compiled into node.

* node.cc(node::Binding): Use the new module lookup function to find
  modules.

* node_{net,crypto}.c: Add NODE_MODULEs to generate the module structure.
2010-07-14 10:17:25 -07:00
isaacs
781d51285d Use execPath for default NODE_PATH, not installPrefix 2010-07-14 09:58:18 -07:00
Jérémy Lal
fb645f75fb Update ronnjs (fix rendering of html self-closing tags) 2010-07-14 09:52:59 -07:00
Ryan Dahl
50c38dec70 Update README, remove ref to Ronn 2010-07-14 09:50:17 -07:00
Mikeal Rogers
16cb45103f Adds "pause" and "resume" events to pump and it's readable argument. 2010-07-13 17:17:20 -07:00
David Siegel
2085909aeb fix corner-case bug in Module
and added a test to expose it
2010-07-13 17:15:10 -07:00
Ryan Dahl
6bf294d71a JSON is %j not %f 2010-07-13 10:16:33 -07:00
Paul Querna
367b87d26d Add support for the module structure to process.dlopen. 2010-07-13 07:08:08 -07:00
Paul Querna
49066042a2 Add basic structure and macros for node modules. 2010-07-13 06:59:53 -07:00
Paul Querna
480164f923 Move node version to a single static header file.
Some compile time variables like the cflags and prefix have been moved to
the node_config.h.in, in the anticipation that they will be removed at
somepoint.
2010-07-13 06:39:47 -07:00
Peter Griess
99a5d1e293 Free kbuf[] in Verify::VerifyFinal(). 2010-07-12 16:37:35 -07:00
Peter Griess
ac2404283e Coverity stack size warnings in DefineConstants(). 2010-07-12 16:37:17 -07:00
rick
c9e505791a use delete for removing events after removing the final listener 2010-07-12 16:29:58 -07:00
Jérémy Lal
abd3f8a02a make node.1 depend on make all 2010-07-12 16:29:42 -07:00
Jérémy Lal
4be4b5f6f4 lib/node, not lib/nodejs ! 2010-07-12 15:23:10 -07:00
Brian
554b02a14c Improve docs
Added default values for many parameters, missing properties and methods,
and slight reorganization of the Child Process section.
2010-07-12 14:23:35 -07:00
Ryan Dahl
d700a6f74a Return child from execFile 2010-07-12 14:18:09 -07:00
Peter Griess
7a706e4206 Coverity fixes: src/platform_linux.cc 2010-07-12 13:20:31 -07:00
Peter Griess
6eb0b6ac27 Coverity fixes: src/node_net 2010-07-12 13:20:31 -07:00
Peter Griess
760fb17bbf Coverity fixes: src/node_file 2010-07-12 13:20:31 -07:00
Peter Griess
792c7caf40 Coverity fixes: src/node_crypto 2010-07-12 13:20:31 -07:00
Peter Griess
4e3c5d88b3 Coverity fixes: src/node.cc 2010-07-12 13:20:26 -07:00
Adam Wiggins
c8dba94ff6 docs for dgram module (UDP and unix sockets) 2010-07-12 11:18:52 -07:00
Jérémy Lal
a7763d55e4 Fix spelling error 2010-07-12 10:35:35 -07:00
Jérémy Lal
2b8a9a8358 Use ronnjs 0.2 to generate docs. Small cosmetic change. 2010-07-12 10:24:09 -07:00
Jérémy Lal
a7e1efc5bd Environment variables NODE_PREFIX, NODE_PATH in node-waf
Those variables have following defaults :
 - NODE_PREFIX is relative to the current path of the node_addon.py file
   It is used as the base path of node include files.
 - NODE_PATH is ~/.node_libraries
   It's where modules are installed when calling `node-waf install`
   Note .js files must be explicitely installed by the module's wscript.

Usage :
NODE_PREFIX=/usr/local NODE_PATH=~/.node_libraries node-waf configure
2010-07-12 07:46:45 -07:00
Ryan Dahl
b1901cd5a5 hack fix to v8 2.2.23 2010-07-07 20:10:01 +02:00
Ryan Dahl
facb904c5d Upgrade V8 to 2.2.23 2010-07-07 19:47:38 +02:00
Dmitriy Shalashov
70a8fb3763 Fix headers with empty value. 2010-07-07 18:46:24 +02:00
Brian
1191ca052f Fix docs
Added consistency to the representation of optional parameters and separated
out multiple functions that were in a single heading.
2010-07-07 16:49:04 +02:00
Jerome Etienne
8e9f59a452 Support of console.dir + console.assert 2010-07-07 16:48:59 +02:00
Ryan Dahl
0bceaaa3d4 Fix addon example in docs 2010-07-07 16:48:53 +02:00
Ryan Dahl
3d948d85ce Remove a bunch of useless waf files 2010-07-04 04:16:55 +02:00
Ryan Dahl
0315251d01 Use 'on' in the docs 2010-07-03 10:54:35 +02:00
Ryan Dahl
515dc2161b Experimental: 'on' as alias to 'addListener' 2010-07-03 09:30:32 +02:00
Ryan Dahl
a6b8586e94 bump version 2010-07-03 08:37:46 +02:00
Ryan Dahl
2072925f12 Upgrade V8 to 2.2.21 2010-07-03 08:37:05 +02:00
Peter Griess
94cd83ef34 Doc fixes for FD related features, upgrade.
- Add docs for 'fd' events, Server.listenFD(), Stream.write(...[, fd])
  and http.Client 'upgrade' event.
2010-07-03 08:18:42 +02:00
Ryan Dahl
82ce3481fe Fix undefined_reference_in_new_context test 2010-07-03 08:16:36 +02:00
Ryan Dahl
192234c689 Remove unnecessary defines in node_events.cc 2010-07-01 23:36:56 -07:00
Ryan Dahl
2998e3bafa Add my awk script to update AUTHORS file 2010-07-01 14:31:42 -07:00
Ryan Dahl
24de2bd58c Amend .gitignore 2010-07-01 14:29:50 -07:00
Ryan Dahl
8a52fb7aeb Revert "Fix 'uncaughtException' for top level exceptions"
This reverts commit 8f8dcf8ed6.
2010-07-01 11:10:22 -07:00
Ryan Dahl
8f8dcf8ed6 Fix 'uncaughtException' for top level exceptions
Done by not evaluating the code in the first tick.

This breaks one test in test-error-reporting.js but I believe this to be a
V8 error and I have reported it in
http://code.google.com/p/v8/issues/detail?id=764
2010-06-30 15:04:40 -07:00
Ryan Dahl
ce8c30c9de Clean up indention on module compile
Remove strange code artifact
2010-06-30 14:30:37 -07:00
Ryan Dahl
d49d53fd49 Expose new HTTP methods 2010-06-30 00:54:08 -07:00
Blake Mizerany
8c8534046c fix whitespace errors 2010-06-29 23:59:24 -07:00
Dmitry Baranovskiy
f8ca6b383c Rewrote QueryString.parse to make it smaller and more effective.
Also added ability to parse foo.bar=4 equal to foo[bar]=4
Added tests for this as well
2010-06-29 23:52:42 -07:00
Ryan Dahl
0a8bd34b69 Resolve .local domains with getaddrinfo()
C-Ares doesn't go through the Name Service Switch (NSS) and thus can't
resolve certain classes of names. Generally this doesn't matter and the
whole idea of NSS is rather annoying. Nevertheless until C-Ares gets better
support, adding this hack to go through getaddrinfo() for .local domain look
up.

This reverts commit 9926dacd14.
2010-06-29 22:15:28 -07:00
Matt Ranney
02ed0ec93b On overlapping buffers use memmove 2010-06-29 21:06:00 -07:00
Blake Mizerany
898afbaf34 Buffer.prototype.write: Indifferent order preference of encoding and offset 2010-06-29 19:56:07 -07:00
Ryan Dahl
5e86d01385 Revert "Buffer.copy should copy through sourceEnd, as specified."
This reverts commit a2f70da4c9.

Keep tests modifies a few edge checks on Copy()
2010-06-29 19:40:20 -07:00
Ryan Dahl
0172cb39f0 Fix incorrect output on docs 2010-06-29 19:28:59 -07:00
Dmitry Baranovskiy
8ec12339f5 Refactored isA, isBool, etc functions to use some of ES5 goodness. 2010-06-29 19:22:28 -07:00
Dmitry Baranovskiy
d3f04933f1 sys.inherts to shadow constructor property from enumerability
thanks to ES5 features in V8 it is quite easily possible.
2010-06-29 19:11:40 -07:00
Ryan Dahl
6b430a95c9 console.log: if not string, coerce into one 2010-06-29 09:53:20 -07:00
Ryan Dahl
5aadeae888 Simply C++ event emitter 2010-06-28 21:20:21 -07:00
Ryan Dahl
b69c6a03b1 If not string, console.log should just print it without trying to format 2010-06-28 21:20:21 -07:00
Ryan Dahl
c9e12204a2 Stub out console.log format strings, info, warn, error 2010-06-28 20:47:35 -07:00
Ryan Dahl
23172c5d85 Lint node_script.cc 2010-06-28 19:37:50 -07:00
Ryan Dahl
e2db605308 Use EVBACKEND_POLL on Solaris; select() is just a wrapper anyway 2010-06-28 15:37:29 -07:00
Ruben Rodriguez
242161bef2 Added new API to Script, and implemented it in the REPL 2010-06-28 15:16:26 -07:00
Ryan Dahl
5a25338ac0 Upgrade V8 to 2.2.20 2010-06-28 08:47:01 -07:00
Rasmus Andersson
67f7fe5e5c Use all available CPUs when building
Automatically set Options.options.jobs to the number of CPUs/cores on the
executing machine, unless the environment variable JOBS is set
2010-06-27 08:49:06 -07:00
Ryan Dahl
bbdd61dc3f Fix supported archs on website 2010-06-25 09:46:10 -07:00
Matt Ranney
a2f70da4c9 Buffer.copy should copy through sourceEnd, as specified.
Improve test-buffer.js to cover all copy error cases.

Fix off by one error in string_decoder.
2010-06-25 09:10:49 -07:00
Ryan Dahl
aa491518f4 Fix authors 2010-06-24 14:37:55 -07:00
Ryan Dahl
444b33584d Remove switch-replace residue 2010-06-24 09:37:36 -07:00
Ryan Dahl
0499618c2b Edit binary encoding docs 2010-06-24 07:51:45 -07:00
Ryan Dahl
8825c74e7a Upgrade http-parser 2010-06-23 21:10:13 -07:00
Ryan Dahl
2c0d91be6c Upgrade V8 to 2.2.19 2010-06-23 20:32:06 -07:00
Ryan Dahl
ba792ea202 :%s/sys.puts/console.log/g
and there was much rejoicing
2010-06-23 20:05:29 -07:00
Ryan Dahl
4c21aa736f Fix name in AUTHORS file 2010-06-23 15:27:56 -07:00
Ryan Dahl
7b119f8b38 Fix error message 2010-06-23 09:09:15 -07:00
Ryan Dahl
f541043618 Remove ini.js 2010-06-22 19:37:29 -07:00
Ryan Dahl
fc175a089d Remove mjsunit from repo 2010-06-22 19:33:01 -07:00
Mikeal Rogers
f62979da6b Add sys.pump 2010-06-22 17:58:09 -07:00
Ryan Dahl
20905d9d62 Fix names in AUTHORS file 2010-06-22 13:23:45 -07:00
Ryan Dahl
1b5ec7017d Don't use NULL in realpath() on darwin, doesn't work in older versions
Thanks to Peter Griess <pg@std.in> for the bug report.
2010-06-22 13:19:49 -07:00
Ryan Dahl
7105aeb22f Doc process.execPath 2010-06-22 02:09:58 -07:00
Marshall Culpepper
ca35ba640a Initial implementation of process.execPath
Darwin, Linux, Solaris. FreeBSD still needs testing.

TODO: Amend the tests where we use spawn with argv[0].
2010-06-22 02:02:25 -07:00
Ryan Dahl
95b252e86d Fix bad email addresses in authors file 2010-06-21 20:41:53 -07:00
Ryan Dahl
a8e9923b44 Add Contributor License Agreement. 2010-06-21 19:40:22 -07:00
Ryan Dahl
9bb890271b Add other OSes to website 2010-06-21 17:03:19 -07:00
Ryan Dahl
a620b7298f bump version 2010-06-21 13:34:10 -07:00
Peter Griess
51bd1b4483 Only concatenate some incoming HTTP headers.
- Concatenate 'accept', 'accept-charset', 'accept-encoding',
  'accept-language', 'connection', 'cookie', and 'x-*' headers.
- For all others, drop duplicates.
2010-06-21 12:01:50 -07:00
Ryan Dahl
545e10f239 wscript shouldn't fail if 'git describe' doesn't work 2010-06-21 10:21:55 -07:00
Ryan Dahl
cb79614f73 Don't encourage strange ideas about req race conditions 2010-06-20 11:56:48 -07:00
Ryan Dahl
eda21cccb4 Fix race condition in test-http-exceptions.js 2010-06-19 23:13:28 -07:00
Ryan Dahl
b93faf9afa Comment out lines with full paths in message test.
Note that * in the .out files is a special wildcard.
2010-06-19 22:51:40 -07:00
Ryan Dahl
1c7057f09c Execute message tests by default 2010-06-19 20:30:49 -07:00
Ryan Dahl
f1a4f17897 script.runIn*Context not throwing errors properly. 2010-06-19 19:31:09 -07:00
Ryan Dahl
7d0252eae2 Fix message tests 2010-06-19 17:41:34 -07:00
Ryan Dahl
125b868e06 Add message tests 2010-06-18 18:14:06 -07:00
Micheil Smith
70c3e661b8 test-child-process-custom-fds to cleanup after running 2010-06-18 10:39:17 -07:00
Micheil Smith
e0d30b545a Renaming tcp tests to net tests 2010-06-18 10:34:56 -07:00
Micheil Smith
3f48276bf9 Coding style changes, added tests in for the md5, sha256, etc methods 2010-06-18 10:21:38 -07:00
Ryan Dahl
9bd3942f70 Add platform_none for cygwin build 2010-06-18 09:46:18 -07:00
Ryan Dahl
84c10265db Fix platform_linux.cc, missing include 2010-06-17 18:36:31 -07:00
Ryan Dahl
01a8d270cf Add platform files, move getmem to node::OS class. 2010-06-17 18:23:43 -07:00
Ryan Dahl
964ed9739b Fix text about threads on homepage 2010-06-17 15:38:02 -07:00
Ryan Dahl
1c6671aa67 Upgrade V8 to 2.2.18 2010-06-16 11:46:01 -07:00
Peter Griess
187f191558 Support 'upgrade' event in HTTP client.
- Add a unit test for client HTTP upgrade.
- Move around unit tests for server HTTP upgrade.
2010-06-16 11:27:56 -07:00
Ryan Dahl
cbf2a2233e Add callback to dgramSocket.send() 2010-06-16 11:03:34 -07:00
David Siegel
81ad8106dc Add UDP broadcast support 2010-06-16 10:45:16 -07:00
Ryan Dahl
cf86527a28 Fix writeFile(buffer) test 2010-06-16 10:28:46 -07:00
Micheil Smith
b05daaaf69 Adding path.existsSync (with tests.) 2010-06-16 10:26:11 -07:00
isaacs
73f207fe59 Throw exceptions, not strings 2010-06-16 10:11:08 -07:00
Aaron Heckmann
1d088fb906 fs.writeFile accepts Buffers 2010-06-15 23:58:32 -07:00
Ryan Dahl
c2e2479cc5 Fix Linux build 2010-06-15 20:04:29 -07:00
Peter Dekkers
e48f0d1dd9 Fixed incorrect mask for determining fs.Stats types 2010-06-15 19:52:37 -07:00
isaacs
4ce100fa62 A replacement for decodeURIComponent that doesn't throw.
And add a few more tests.
2010-06-15 19:28:09 -07:00
Ryan Dahl
ed5f4f3a44 RootCaCerts shouldn't be global 2010-06-15 18:29:45 -07:00
Ryan Dahl
6bed15e074 Refactor: Utf8Decoder -> StringDecoder
Instead of just decoding Utf8, this will proxy requests to buffer.toString()
for other encodings. This makes for a simpler interface.
2010-06-15 18:19:27 -07:00
Peter Griess
4b48042c17 Wrap FD in closure before emitting from Stream.
- Without this, recvMsg can be invoked before the event emitter gets a
  chance to run. In this case, recvMsg.fd will be overwritten and the
  original caller can end up emitting null.
2010-06-15 15:10:30 -07:00
Ryan Dahl
bc76624ec7 Upgrade V8 to 2.2.17 2010-06-15 14:52:00 -07:00
Ben Lowery
f3cd7bbe77 Coerce each argument to a String before attempting to print it via sys.print 2010-06-15 14:44:09 -07:00
Ryan Dahl
459440842f More lint on node_crypto 2010-06-15 13:36:01 -07:00
Ryan Dahl
9854216d36 Fix a bunch of memory leaks in node_crypto 2010-06-15 13:31:59 -07:00
Ryan Dahl
5bc00abed7 Lint node_crypto.cc 2010-06-15 13:16:20 -07:00
Ryan Dahl
5f88097eb4 Remove unused code from node_crypto 2010-06-15 12:41:14 -07:00
Ryan Dahl
14414f81f3 Soft deprecation of 'listening' event.
Add callback param to listen() instead
2010-06-15 12:38:25 -07:00
Peter Griess
c9dde726c6 Test case for net.Server.listenFD() 2010-06-15 11:44:33 -07:00
isaacs
1ffdad010b Expose the FD numbers for stdin and stderr on process.binding("stdio") 2010-06-14 15:10:00 -07:00
Ryan Dahl
d6072766ed Fix memory leak in hash.update() 2010-06-14 14:38:40 -07:00
Ryan Dahl
009b4569b3 Merge Hash.init() function into JS constructor 2010-06-14 13:10:23 -07:00
Felix Geisendörfer
5f3906b65e Fix: fs.writeFile could not handle utf8 2010-06-14 10:58:17 -07:00
Paul Querna
02da5ed4a1 Implement datagram sockets
- Adds new dgram module, for all data-gram type transports
- Supports both UDP client and servers
- Supports Unix Daemon sockets in DGRAM mode too (think syslog)
- Uses a shared Buffer and slices that as needed to be reasonably
  performant.
- One supplied test program so far, test-dgram-pingpong
- Passes test cases on osx 10.6 and ubuntu 9.10u
2010-06-12 02:41:45 -07:00
isaacs
e65e6039a8 Fix #169. Expose require members in the repl.
This fixes #169 by putting the require members onto the cwdRequire function
which is exposed to the repl scope.
2010-06-11 14:04:58 -07:00
Brian McKenna
431e72cbe8 Make addon building work for Cygwin. 2010-06-11 13:25:03 -07:00
isaacs
94be898fbc Remove "uri" module.
The deprecation warning was broken, so clearly no one is using this thing.
2010-06-11 13:19:50 -07:00
Ryan Dahl
4e80587cbe Add Orlando to changelog 2010-06-11 13:16:08 -07:00
Ryan Dahl
10d8adb089 bump version 2010-06-11 12:58:14 -07:00
Ryan Dahl
9c85357846 Upgrade C-Ares to 1.7.3 2010-06-11 12:48:58 -07:00
Ryan Dahl
d127d15d1b License file maintenance.
- reference to OpenSSL
- note about http-parser
2010-06-11 12:48:25 -07:00
Matt Ranney
cbd1f1481c Remove setTimeout from initial example and description. 2010-06-10 23:55:46 -07:00
Ryan Dahl
fe89caba2e Improve fs.write tests 2010-06-10 15:17:46 -07:00
Ryan Dahl
0e390d69a8 Don't use bzero 2010-06-10 07:58:24 -07:00
Jérémy Lal
ce347124e6 The underscores are not meant to emphasize. Escape them. 2010-06-10 07:15:27 -07:00
Raffaele Sena
b3b81d67ff Port to cygwin 2010-06-09 15:08:46 -07:00
Ryan Dahl
cd232a9cce Upgrade V8 to 2.2.16 2010-06-09 10:09:37 -07:00
Matt Ranney
cec775a0de Web site example fixes. 2010-06-09 00:52:28 -07:00
Ryan Dahl
0bb47b6c97 Upgrade V8 to 2.2.15 2010-06-09 00:52:06 -07:00
Peter Griess
de6d663a67 Add 'type' parameter to net.Server.listenFD()
This is needed in case the provided socket is not the default 'tcp4' type
(i.e. and needs different read/write/etc methods). With this patch, one can
call listenFD(sock, 'unix') to bind to existing UNIX domain sockets.
2010-06-08 18:09:17 -07:00
Ryan Dahl
bca16a0581 Handle ctrl+z from readline 2010-06-08 17:49:22 -07:00
Ryan Dahl
adc06dd705 Add NODE_NO_READLINE check for REPL
Setting this environmental variable to a non-zero integer will start all
REPL interfaces without readline. For use with rlwrap.
2010-06-08 15:44:43 -07:00
Ryan Dahl
0377b12964 Use strings instead of buffers in readline
For eventual large character support.
2010-06-08 10:00:43 -07:00
Ryan Dahl
a6942b345d Fix test-repl 2010-06-07 17:39:52 -07:00
Matt Ranney
09af242c89 Support more readline navigation keys. 2010-06-07 16:51:07 -07:00
Ryan Dahl
0c3b6aba7a Do not output \n on stderr on output, breaks tests 2010-06-07 16:23:48 -07:00
Ryan Dahl
6056d2ea2c node without arguments starts the REPL 2010-06-07 16:15:41 -07:00
Ryan Dahl
e43d6fc879 Fix misspelling 2010-06-07 16:03:57 -07:00
Ryan Dahl
41f213be18 Add binding to termios, implement readline for repl 2010-06-07 15:24:21 -07:00
Peter Griess
a0134ff0f8 add net.Server.listenFD
Now that FD passing is in master, it'd be great to be able to use a received
socket (which has already had bind(2) and listen(2) called on it) to fire up a
new net.Server instance. This patch adds a net.Server.listenFD() method which
will start up the accept watcher on the provided FD.
2010-06-07 10:13:30 -07:00
Ryan Dahl
9be6c501ec Upgrade http-parser 2010-06-06 17:41:03 -07:00
Ryan Dahl
935f8437fd Allow ObjectWrap destructors before Wrap() 2010-06-04 14:30:59 -07:00
Ryan Dahl
9e8df0e836 More dynamic linking options (again)
Original commit: 75f0cf471a
2010-06-04 11:42:34 -07:00
Peter Griess
78d33f4fd5 Fix options parsing
The current node has a bug where it will fail to pass the option argument
immediately preceding the first non-option argument to V8. That is the
--perf flag will be ignored by V8 when running 'node --perf script.js'.
2010-06-04 08:29:10 -07:00
Ryan Dahl
0055dd133d Apply fix for V8 bug 728 2010-06-03 18:50:44 -07:00
Ryan Dahl
3104662bab Use a less common port in docs 2010-06-03 18:45:35 -07:00
Ryan Dahl
62d9bff06b Fix ability to disable TCP timeouts with setTimeout(0) 2010-06-03 11:01:47 -07:00
Felix Geisendörfer
987cbe35c6 Fix: require.async module exception delegation
The fs.readFile bug was hiding another bug that was causing this test
to pass, even so it was broken:

require.async("../fixtures/throws_error1") in test-module-loading.js

This patch fixes the original test by running _compile within a
try..catch block for _loadScript.

_loadScriptSync also had some useless (deprecated?) code for dealing
with module entry point exceptions. This code was also removed for
greater clarity.
2010-06-03 09:59:56 -07:00
Felix Geisendörfer
55e964ec19 Fix: fs.readFile would execute callbacks twice
fs.readFile was executing a callback in a try..catch context, which is
a problem in itself. To make matters worse, it would re-execute the
same callback if there was an execution.

This patch fixes both of these problems.
2010-06-03 09:40:40 -07:00
rentzsch
55d7352189 DOC note stats.isSymbolicLink() is only valid with fs.lstat().
ref: <http://github.com/ry/node/issues#issue/153>
2010-06-03 00:26:23 -07:00
Peter Griess
8f0b4e9111 Send and receive file descriptors through net.Stream.
a) create a layer of indirection in net.Stream to allow swapping in
different read/write implementations and

b) emit an 'fd' event when file descriptors are received over a UNIX pipe,
as finally as a tangential benefit

c) remove a bunch of conditionals from the primary codepaths for
ease-of-reading.
2010-06-02 18:16:53 -07:00
Ryan Dahl
55a6f01732 Server responses should have a body if HEAD request 2010-06-02 15:07:15 -07:00
Ryan Dahl
ef9f4046c9 Better 'make' output
Removes 'make all-debug' since it is unnecessary now.
2010-06-02 13:03:31 -07:00
Orlando Vazquez
92da636b97 Add a parameter to spawn() that sets the child's stdio file descriptors.
After the child is forked, these file descriptors will get dup2()'d to STDIN,
STDIO, and STDERR.

(API may be changed.)
2010-06-02 10:41:24 -07:00
Ryan Dahl
501136b999 Revert "More dynmaic linking options"
Broke the build. Will fix and reapply soon.

This reverts commit 75f0cf471a.
2010-06-02 09:16:28 -07:00
Ryan Dahl
75f0cf471a More dynmaic linking options
This adds the following options to the `configure` program

  --shared-v8           Link to a shared V8 DLL instead of static linking
  --shared-v8-includes=SHARED_V8_INCLUDES
                        Directory containing V8 header files
  --shared-v8-libpath=SHARED_V8_LIBPATH
                        A directory to search for the shared V8 DLL
  --shared-cares        Link to a shared C-Ares DLL instead of static linking
  --shared-cares-includes=SHARED_CARES_INCLUDES
                        Directory containing C-Ares header files
  --shared-cares-libpath=SHARED_CARES_LIBPATH
                        A directory to search for the shared C-Ares DLL
  --shared-libev        Link to a shared libev DLL instead of static linking
  --shared-libev-includes=SHARED_LIBEV_INCLUDES
                        Directory containing libev header files
  --shared-libev-libpath=SHARED_LIBEV_LIBPATH
                        A directory to search for the shared libev DLL

and removes --system.
2010-06-01 20:18:43 -07:00
Ryan Dahl
d62b0f442a Fix style in sys.js 2010-06-01 09:28:56 -07:00
Ryan Dahl
f86a214357 Upgrade to V8 2.2.13 2010-05-31 11:52:20 -07:00
Ryan Dahl
0c1aa36835 bump version 2010-05-29 19:37:57 -07:00
Ryan Dahl
16818ff250 Remove throttling bug notes 2010-05-29 19:37:56 -07:00
Ryan Dahl
1a5acd9850 API: readFileSync without encoding argument now returns a Buffer
Correctly load utf8 data; add a test test-fs-read-file-sync.js
2010-05-29 13:38:00 -07:00
Ryan Dahl
c82d64649c Deprecate the 'ini' module 2010-05-29 13:14:38 -07:00
Ryan Dahl
78e49f1c88 Rename node_net2.cc to node_net.cc 2010-05-29 13:08:05 -07:00
isaacs
a26f7d753d Make require() from the repl be relative to cwd 2010-05-29 12:35:30 -07:00
isaacs
82813f2f8c Execute repl code in new context 2010-05-29 12:33:55 -07:00
isaacs
3c7873bd3f Use duck-typing as well as instanceof in sys.inspect
This makes it so that inspecting objects from other contexts works as expected.
2010-05-29 12:31:46 -07:00
Ryan Dahl
2fa4de001c addons should have debugging symbols 2010-05-29 12:25:28 -07:00
Tim Caswell
b480184fd6 Check for a couple of edge cases on the inspect hook.
Don't treat sys.inspect special, same with prototype objects.
2010-05-28 15:40:25 -07:00
Tim Caswell
7f5320b167 Provide a hook for user-specified inspect functions 2010-05-28 14:29:51 -07:00
Ryan Dahl
80a8e71fe0 Insert some hot paths into HTTP 2010-05-27 20:43:56 -07:00
Ryan Dahl
74b7fa29a1 Refactor HTTP
Allow throttling from outgoing messages.
2010-05-27 20:41:57 -07:00
Ryan Dahl
0e713e7482 :%s/8000/PORT/g for a few tests 2010-05-27 20:41:57 -07:00
Brian White
72262060db Added support for OpenBSD 32-bit for c-ares 2010-05-27 14:02:16 -07:00
Ryan Dahl
8840ce340d Bugfix: fs.ReadStream.setEncoding
Improve test-fs-read-stream test.
2010-05-26 18:33:38 -07:00
Ryan Dahl
31854c7990 Fix Solaris V8 build
Patch submitted to V8: http://codereview.chromium.org/2282003/show
2010-05-26 18:05:44 -07:00
Micheil Smith
d89de07758 Adding experimental support for fs.chown and fs.chownSync.
Notes:
- Currently only accepts numeric user and group ids.
- No tests, as tests depend on getpwuid and getgrgid.
- No documentation, as there is no tests and this is experimental.
2010-05-26 13:37:45 -07:00
Ryan Dahl
29e867aaa0 Simplify a few internal HTTP events. 2010-05-26 13:37:33 -07:00
Ryan Dahl
311a62dea7 Fix JOBS for Solaris make 2010-05-26 13:07:45 -07:00
Ryan Dahl
4b216d266a Remove -Werror from V8 SConstruct 2010-05-26 10:48:20 -07:00
Ryan Dahl
d4345e1ff8 Upgrade V8 to 2.2.12 2010-05-26 10:15:43 -07:00
Sam Hughes
895f89d62a Avoided sending empty chunkedEncoding chunks in the middle of http responses 2010-05-25 22:58:17 -07:00
Ryan Dahl
15ec99ec59 Fix issue 89, parsing responses to HEAD requests
Test from Mark Hansen (mark at markhansen.co.nz)
2010-05-25 19:25:40 -07:00
Ryan Dahl
35c14f637e In HTTP parser, proxy return value of onHeadersComplete 2010-05-25 19:25:38 -07:00
Ryan Dahl
2fca40e44f Upgrade http-parser 2010-05-25 19:25:35 -07:00
Ryan Dahl
e97a481785 Destroy REPL pipes instead of shutting down. 2010-05-24 17:14:13 -07:00
Ryan Dahl
19f475c573 fs.ReadStream should emit Buffers
And do proper utf8 encoding.
2010-05-24 15:47:42 -07:00
Ryan Dahl
3768aaaea4 Create a public Buffer constructor for use in addons. 2010-05-24 13:26:18 -07:00
Aapo Laitinen
c4876d01a1 Change the behavior of path.extname
Make path.extname return an empty string also if:
- The last dot is not in the last path component
- The last dot starts the last path component
2010-05-24 09:56:28 -07:00
Brian White
ab5c0dd63e Port to OpenBSD 2010-05-23 17:08:57 -07:00
Ryan Dahl
0f143f6c23 Upgrade libeio 2010-05-23 17:02:35 -07:00
Ben Noordhuis
b58db3cd73 Added reason phrases for a bunch of HTTP status codes. 2010-05-23 17:02:35 -07:00
Ryan Dahl
1369d606f7 Add bug notes about HTTP streams and throttling 2010-05-22 13:02:30 -07:00
Mikeal Rogers
fe3d8f2411 Add assert.ifError 2010-05-21 12:06:12 -07:00
Ryan Dahl
2b34363d03 Upgrade V8 to 2.2.11 2010-05-21 09:41:50 -07:00
Ryan Dahl
9514a4d547 bump version 2010-05-21 02:55:38 -07:00
Ryan Dahl
0de138acb5 improve test for stdio non-blockingness 2010-05-21 01:22:20 -07:00
Ryan Dahl
f73b6e2190 Fix opposite logic, which coincidentially works 2010-05-20 22:11:26 -07:00
Ryan Dahl
8c56284776 Remove unneeded fd variables in node_stdio.cc 2010-05-20 22:01:13 -07:00
Felix Geisendörfer
c93e0aaf06 Deprecate string interface for fs.read()
This patch makes buffers the preferred output for fs.read() and
fs.readSync(). The old string interface is still supported by
converting buffers to strings dynamically. This allows to remove the
C++ code for string handling which is also part of this patch.
2010-05-20 16:31:18 -07:00
Ryan Dahl
e84395ff8c Revert "Deprecate string interface for fs.read()"
This reverts commit cbbf9e43d1.
2010-05-20 16:11:33 -07:00
Felix Geisendörfer
cbbf9e43d1 Deprecate string interface for fs.read()
This patch makes buffers the preferred output for fs.read() and
fs.readSync(). The old string interface is still supported by
converting buffers to strings dynamically. This allows to remove the
C++ code for string handling which is also part of this patch.
2010-05-20 15:25:49 -07:00
Ryan Dahl
cbd2c3945b Throwing in a callback should kill the process
There is a difference between errors which happen to a socket - like
receiving EPIPE - an exceptional situation but ultimately okay and the
situation where code throws in a callback - which is not okay.

Fixes test/simple/test-http-exceptions.js

TODO: explain this in docs.
2010-05-20 15:23:36 -07:00
rentzsch
36a45c4e0d FIX path.dirname('/tmp') => '/'.
Previously path.dirname('/tmp') incorrectly returned '.'.

Unfortunately module.js incorrectly thinks dirname('/a/b/') should
yield '/a/b', so I can't strip trailing slashes yet. Once module.js
is fixed, then the commented-out code should be activated and a test
written for it.
2010-05-20 10:16:09 -07:00
Ryan Dahl
022c083848 Deprecate sys.p() 2010-05-20 10:12:05 -07:00
Ryan Dahl
44ad6a7db2 Make buffer's c++ constructor public 2010-05-20 09:44:10 -07:00
isaacs
5b740c488f Fix a leaking global 2010-05-20 09:38:25 -07:00
isaacs
78be1e4930 Remove the ReportException from the Script class
This is so that syntax errors can be handled discretely in places like the
repl, where SyntaxErrors are expected and normal.
2010-05-19 15:02:47 -07:00
Ryan Dahl
d8af9d8edf Minor style changes for fs.write code 2010-05-19 14:59:03 -07:00
Felix Geisendörfer
c46cbe0de4 Deprecate string interface for fs.write()
This patch makes buffers the preferred input for fs.write() and
fs.writeSync(). The old string interface is still supported by
converting strings to buffers dynamically. This allows to remove the
C++ code for string handling which is also part of this patch.
2010-05-19 12:53:43 -07:00
Ryan Dahl
c489c2c1b5 Fix api for request.connection 2010-05-19 11:01:21 -07:00
Peter Griess
2420f07e94 Allow process.setuid() and process.setgid() to accept string names in lieu of numeric IDs 2010-05-18 17:41:10 -07:00
Ryan Dahl
2663c69f8d Fix utf8stream references 2010-05-18 09:32:28 -07:00
Felix Geisendörfer
f987ecf45b Use Utf8Stream for http Streams with utf8 encoding 2010-05-18 01:04:39 -07:00
Felix Geisendörfer
ed5f1162fa Use Utf8Stream for net Streams with utf8 encoding 2010-05-18 01:02:15 -07:00
Felix Geisendörfer
caba9c70c3 Implemented Utf8Decoder module
Allows to safely decode a utf8 stream into strings without breaking
on multibyte characters.
2010-05-17 22:12:30 -07:00
Ryan Dahl
e232f09d38 fs.WriteStream.write should support buffer
Also re-adding the callback parameter.
2010-05-17 19:44:14 -07:00
Ryan Dahl
1036aa9762 Fix errno display in c-ares exceptions 2010-05-17 13:58:15 -07:00
Felix Geisendörfer
0a539865dd Support arrays and strings in buffer constructor
This is be very useful for testing code that deals with buffers.
2010-05-17 11:19:14 -07:00
visionmedia
45948e054d Added better error messages for async and sync fs calls with paths 2010-05-14 19:46:16 -07:00
Jonas Pfenniger
53a9869ff7 FIX: EventEmitter#removeAllListeners signature
This function should return this is all cases.
2010-05-14 19:15:07 -07:00
Jonas Pfenniger
fea6f829bf FIX: EventEmitter#removeListener logic
In the case of one defined listener, the function should only remove it
if it is the same as the passed listener.
2010-05-14 19:13:50 -07:00
Jonas Pfenniger
4274e6b7d0 FIX: signal-unregister bug
We now restore the default signal behavior when all listeners are
removed for a given signal.

Re-enabled test-signal-unregister
2010-05-14 19:05:19 -07:00
Jonas Pfenniger
50148022d1 Thinner SignalWatcher, only using callback
Since it is only used internally, we don't need the complexity of
EventEmitter. The new SignalWatcher's design was copied from
IdleWatcher.
2010-05-14 18:57:17 -07:00
Andrew Johnston
9599607065 Added posix fsync and fdatasync to fs module 2010-05-14 18:42:22 -07:00
Ryan Dahl
ac3a2d899a Changes to work on Solaris 10 2010-05-14 16:38:17 -07:00
Ryan Dahl
a9b962a653 Add --without-ssl configure option 2010-05-14 16:34:47 -07:00
Ryan Dahl
0b7bda8f46 Remove some unused cruft from wscript 2010-05-14 16:30:58 -07:00
Ryan Dahl
da9323040f Simplify stack trace reporting using new V8 API 2010-05-14 11:48:14 -07:00
Ryan Dahl
320d3e9d33 Fix AUTHORS file 2010-05-14 11:15:31 -07:00
Matt Ranney
cd4f94e71a Add test for exceptions in HTTP parser event handlers. 2010-05-14 10:16:55 -07:00
Matt Ranney
307e70afaf Remove unused CSS reference. 2010-05-14 10:12:03 -07:00
Matt Ranney
1f0963558c Add process.version description. 2010-05-14 10:11:47 -07:00
Jérémy Lal
4e40e8804b System EV compatibility fix : use EV_DEFAULT_UC 2010-05-13 16:56:13 -07:00
Ryan Dahl
0914d33842 bump version 2010-05-13 16:24:28 -07:00
Ryan Dahl
23d680bb85 Allow parallel jobs to be passed to V8 build
e.g. JOBS=2 make
2010-05-13 16:24:28 -07:00
Ryan Dahl
ce2d5ad0d7 Change the 'make dist' to remove v8 test dir 2010-05-13 15:55:02 -07:00
Elijah Insua
976926376d Handle empty files with fs.readFile 2010-05-13 12:42:17 -07:00
Ben Noordhuis
c6c77d535f Support for fstat(2) through fs.fstat() and fs.fstatSync(). Added test cases, updated documentation. 2010-05-12 14:20:43 -07:00
Ryan Dahl
67eeedd602 Disable test-signal-unregister.js as functionality doesn't exist yet 2010-05-12 12:45:53 -07:00
Ryan Dahl
1c7670aca2 Remove reference to C++ EventEmitter in docs
I prefer ppl to use ObjectWrap
2010-05-12 12:17:53 -07:00
Ryan Dahl
d0128787e7 Deprecate sendHeader() and writeHeader(), ppl should use writeHead() 2010-05-12 12:15:58 -07:00
Ryan Dahl
7a2e6d674a Default to 2 second timeout for http servers
Taking a performance hit on 'hello world' benchmark by enabling this by
default, but I think it's worth it. Hopefully we can improve performance by
resetting the timeout less often - ideally a 'hello world' benchmark would
only touch the one timer once - if it runs in less than 2 seconds. The rest
should be just link list manipulations.
2010-05-12 11:49:28 -07:00
Ryan Dahl
ed0c109950 Add note about 'error' event to docs 2010-05-12 10:42:14 -07:00
Ryan Dahl
d2cff34fa3 Idle timeout changes
- setTimeout should active the timeout too. (test-net-set-timeout tests
  this.)

- 'timeout' event is not automatically followed by an 'error' event. That
  is the user is now responsible for destroying the stream if there is an
  idle timeout.
2010-05-12 10:06:13 -07:00
Ryan Dahl
f7ff548dd0 Quote variables in configure script 2010-05-11 10:25:27 -07:00
Ryan Dahl
c90e44e582 Just add an extra include for strings.h - don't try to be cute 2010-05-10 16:38:47 -07:00
Ryan Dahl
8e5b91c79b Revert "Check for strings.h"
This reverts commit 032f651824.
2010-05-10 16:38:14 -07:00
Ryan Dahl
032f651824 Check for strings.h 2010-05-10 16:30:31 -07:00
Ryan Dahl
35dd0fb271 Patch v8 build for solaris
Submitted this patch to V8
http://codereview.chromium.org/1990010/show
2010-05-10 16:28:02 -07:00
Ryan Dahl
615d890622 Upgrade V8 to 2.2.9 2010-05-10 09:58:20 -07:00
Ryan Dahl
8ab238e7de Revert "destroy instead of end http connection at end of pipeline"
This reverts commit 4ce1e1fca5.

To fix test-http-full-response.js. Clearly this is not the correct solution.
Probably need idle timeouts.
2010-05-09 21:29:51 -07:00
Ryan Dahl
15bb392afd Disable test-remote-module-loading
In ab068db9b1 this test was broken because (I
think) compile/run errors are set to crash the program instead of being
passed back.

Error reporting is more important than remote loading. Disabling until there
is a fix
2010-05-09 18:46:04 -07:00
Ryan Dahl
b78508266b Change string.h to strings.h compile on solaris 2010-05-09 16:29:23 -07:00
Ryan Dahl
1ecb11f944 Add failing test - http responses not all complete
Report and test by soderblom.peter@gmail.com
2010-05-09 15:08:54 -07:00
Ryan Dahl
ab068db9b1 Improve error reporting
- No more single line "node.js:176:9" errors
- No more strange output when error happens on first line due to
  module wrapper function.
- A few tests to check these things
2010-05-09 13:55:42 -07:00
Ryan Dahl
1d28cfcfb9 Better logic for testing if an argument is a port
If you did server.listen('123') it would open a socket in the current
directory called 123. Now it will interpret it as a port.
2010-05-09 12:10:42 -07:00
Ryan Dahl
d38d96eb61 Don't emit 'exit' twice from child process 2010-05-08 23:28:26 -07:00
Ryan Dahl
d7762dffe3 Forgot to add child_process_should_emit_error.js 2010-05-08 23:24:24 -07:00
Ryan Dahl
264e540d00 Fix error reporting in child_process callbacks
Issue 120, test case by Nathan Ostgard
2010-05-08 22:13:34 -07:00
rentzsch
a5b132ad63 fs.Stats.size V8::Integer => V8::Number.
While VM::Integer::Value() offers an int64_t, V8::Integer::New() only
accepts an int32_t, truncating fs.Stat's size in BuildStatsObject().

I consider this a bug in V8, and we should move back to V8::Integer
when it gets a ctr that allows a int64_t. Until then, this work-around
should hold.
2010-05-08 19:52:22 -07:00
Ryan Dahl
3ac6deefa8 Change GC idle notify so that it runs along side setInterval
Doesn't appear any slower. Also checks for high memory usage and tries to
force more notifications.
2010-05-07 19:06:05 -07:00
isaacs
bc45adcffa Add binding.close to fs.readFile 2010-05-07 13:17:57 -07:00
Tim Caswell
c07c601c3b fs.readFile uses a buffer internally and will return the raw buffer if no encoding is specified. 2010-05-06 22:22:14 -07:00
Ryan Dahl
62b642a88d fix authors file 2010-05-06 14:15:16 -07:00
Ryan Dahl
d2415945c1 Install node_buffer.h on make install 2010-05-06 14:14:52 -07:00
Ryan Dahl
f711d5343b bump version 2010-05-06 10:39:27 -07:00
Ryan Dahl
6aab6ebe61 Upgrade V8 to 2.2.8 2010-05-06 09:59:35 -07:00
Ryan Dahl
4ce1e1fca5 destroy instead of end http connection at end of pipeline 2010-05-06 09:15:44 -07:00
Thomas Lee
3674563dd5 Fix a bug in http.Client where parsers may be prematurely released back to the free pool. 2010-05-06 00:44:07 -07:00
Jonathan Knezek
82c8973dfa Changed undefined pos to null to prevent hanging on SheevaPlug 2010-05-05 22:34:36 -07:00
Jonathan Knezek
874b80bd6a Added c-ares headers for linux-arm 2010-05-05 22:33:53 -07:00
Ryan Dahl
ab723d022d Add buffer response to http_simple.js 2010-05-04 22:35:55 -07:00
Ryan Dahl
1415650463 Use test port instead of 8000 in test-http-304 2010-05-04 22:06:46 -07:00
isaacs
c0d42b0365 Look in /usr/local/lib/node for modules, so that there's a way to install modules globally 2010-05-04 22:02:16 -07:00
Matt Ranney
eb4951d499 Add proper HTML header for changelog so UTF-8 works. 2010-05-04 21:36:10 -07:00
Ryan Dahl
453c9e6411 Fix whitespace 2010-05-04 21:35:46 -07:00
isaacs
3892628657 Emit a better error message when something strange is sent to OutgoingMessage#write 2010-05-04 18:37:00 -07:00
Ryan Dahl
d044e2de07 Lazy load crypto
The whole program is being slowed down by the large CA string in crypto.
Why?
2010-05-04 14:21:14 -07:00
Rhys Jones
afce4c3ae8 Added default CAs, updated openssl verify behaviour, added crypto and https documentation 2010-05-04 14:12:54 -07:00
Ryan Dahl
b6c5cf60b7 Ignore SIGPIPE
Was inadvertently removed with evcom,
c72967d335 (L10L1900)
2010-05-04 10:41:56 -07:00
Peter Griess
d9882395e2 Fix SEGV by setting msg_controllen earlier.
- Some implementations of CMSG_FIRSTHDR() rely on msg_controllen being
  set correctly, else it returns NULL: see <linux/socket.h>.
2010-05-04 10:32:01 -07:00
Rhys Jones
1a317135c5 Additional OpenSSL tests 2010-05-03 16:15:06 -07:00
Paulo Matias
430cfd1825 Read all records to always empty the OpenSSL reading buffer. 2010-05-03 16:11:42 -07:00
Paulo Matias
3fed1cf36f Make it possible to use client certificates to connect with a nodejs server, and make verifyPeer behaviour consistant. 2010-05-03 16:06:42 -07:00
Ryan Dahl
ea37d98949 Implement writeSync for buffers
(Needs tests still)
2010-05-03 13:26:09 -07:00
Ryan Dahl
3202bce288 Implement fs.readSync for buffers 2010-05-03 13:18:33 -07:00
Ryan Dahl
d76091d7d1 Implement fs.read() for Buffers (again) 2010-05-03 12:56:11 -07:00
Ryan Dahl
7a9c81d2dc Fix memory leak with fs.writeSync 2010-05-03 11:41:30 -07:00
Ryan Dahl
b5bdf9434b Add another http upgrade test 2010-05-03 11:23:36 -07:00
Ryan Dahl
f0fec7352a Don't emit error twice from http.Client 2010-05-03 10:53:52 -07:00
Michaeljohn Clement
fd3e1ca3e2 documentation typos and tweaks 2010-05-03 00:15:35 -07:00
Ryan Dahl
48d58f92f1 Add symbols to release build 2010-05-02 18:20:02 -07:00
Ryan Dahl
d13f518010 Revert changes to node_file.cc
Revert "Fix memory leak in fs.writeSync()"

This reverts commit 5457eae28c.

Revert "Implement fs.read() for buffers"

This reverts commit 692f580a07.
2010-05-02 17:38:32 -07:00
Ryan Dahl
99984772df Allow different ports for http_simple.js 2010-05-02 17:26:18 -07:00
Ryan Dahl
5457eae28c Fix memory leak in fs.writeSync() 2010-05-02 17:02:13 -07:00
Ryan Dahl
61364f9443 GnuTLS -> OpenSSL on website 2010-05-02 11:19:01 -07:00
dpb587
a1f23c1aa1 Fix a couple mistypes in API doc 2010-05-01 19:16:00 -07:00
Micheil Smith
3db613e31a Documenting http.Server#event:upgrade 2010-05-01 19:15:50 -07:00
Micheil Smith
aee226b243 Fixing the 1 byte off error in http.Server's upgradeHead
(And fix up some style issues)
2010-05-01 18:05:53 -07:00
Ryan Dahl
67fb0ece6b Fix deprecation message 2010-05-01 14:45:14 -07:00
Micheil Smith
d6110fbd11 Making requestListener for the construction of a http.Server optional, as it is for net.Server 2010-05-01 11:56:00 -07:00
Micheil Smith
f990f24ad3 Implementing the event emit for Upgrade requests, with tests. 2010-05-01 11:52:40 -07:00
Ryan Dahl
692f580a07 Implement fs.read() for buffers 2010-04-30 18:36:36 -07:00
kriskowal
8d1f1186ca Fixed/Completed buffer copy range checks. 2010-04-30 17:36:21 -07:00
Ryan Dahl
20372d2df3 Fix docs in node_file.cc 2010-04-30 15:35:51 -07:00
Ryan Dahl
285c5ed36f Fix some styling in the docs 2010-04-30 10:33:56 -07:00
Ryan Dahl
5b2801e3ea Add http server 'request' event to docs 2010-04-30 10:31:21 -07:00
Ryan Dahl
3b323027be http server emits 'clientError' 2010-04-30 10:29:35 -07:00
Ryan Dahl
557ba6bd97 bump version 2010-04-29 17:44:51 -07:00
Ryan Dahl
301b44d45d Chunk strings together on Stream buffer 2010-04-29 12:00:37 -07:00
Ryan Dahl
c75e4cb48a fix typos 2010-04-29 10:11:06 -07:00
Ryan Dahl
f919216446 Upgrade http-parser, fixes issue 77
http://github.com/ry/node/issues#issue/77
2010-04-28 23:28:52 -07:00
Thomas Lee
a63ce5cd72 Allow callers to disable PHP/Rails style parameter mungeing in querystring.stringify 2010-04-28 16:18:48 -07:00
Herbert Vojčík
039d13b0c3 DRY binding('stdio') 2010-04-28 16:08:36 -07:00
Ryan Dahl
6d85802100 basicRequest -> module.requireNative 2010-04-28 15:28:21 -07:00
Ryan Dahl
3bb21b5191 Fix signo_string for linux and solaris 2010-04-28 15:07:15 -07:00
Herbert Vojčík
7a72885ede process.evalcx has a deprecation message. 2010-04-28 14:40:11 -07:00
Herbert Vojčík
7e4c1285dc Minor stylistic changes. 2010-04-28 14:39:41 -07:00
Herbert Vojčík
5d9753fccf Fix child_process.cc build failure for FreeBSD. 2010-04-28 14:21:52 -07:00
Felix Geisendörfer
f8a3cf980f Properly handle child process exit codes
The child process 'exit' was returning the status of the process, rather than
the exit code. This patch properly deconstructs the status into the exit code
and the term signal a process may have received.

See:
http://pod.tst.eu/http://cvs.schmorp.de/libev/ev.pod#Watcher_Specific_Functions_and_Data_-5
and waitpid(2)
2010-04-28 13:54:17 -07:00
Ryan Dahl
9b2aac61b2 Resolve EWOULDBLOCK to string if different thatn EAGAIN 2010-04-28 12:58:51 -07:00
Ryan Dahl
3b75f5070d Upgrade V8 to 2.2.6 2010-04-28 10:46:26 -07:00
Tim Caswell
8f79169aef Remove node.* deprecation messages. 2010-04-28 09:47:50 -07:00
Ryan Dahl
e7a1fa1293 fs.FileWriteStream -> fs.WriteStream, fs.FileReadStream -> fs.ReadStream 2010-04-27 18:52:16 -07:00
Ryan Dahl
5aea12b4c4 stdout should be writable only 2010-04-27 18:45:10 -07:00
Felix Geisendörfer
203561208e Remove coupling dep 2010-04-27 18:17:30 -07:00
Felix Geisendörfer
c143cba590 Get rid of coupling for stdin 2010-04-27 18:02:30 -07:00
Felix Geisendörfer
f2212fa59d Support for FileReadStream.setEncoding 2010-04-27 17:31:04 -07:00
Felix Geisendörfer
76f98c27de Get rid of coupling for stdout 2010-04-27 17:27:34 -07:00
Ryan Dahl
f618551694 Remove callback argument to FileWriteStream.prototype.write 2010-04-27 17:26:10 -07:00
Matt Ranney
d1b352e4b3 Shorten some long lines. 2010-04-27 00:52:40 -07:00
Ryan Dahl
24931f8405 Upgrade V8 to 2.2.5 2010-04-27 00:31:47 -07:00
Matt Ranney
2374e557e3 More Buffer descriptions and examples.
Updated Script examples for New Script methods.
2010-04-27 00:25:58 -07:00
Ryan Dahl
e235aae018 Fix bug in socket write optimization
Thanks to tlb@tlb.org for finding it!
2010-04-26 20:26:43 -07:00
Ryan Dahl
c7b3c1ecbc Add more asserts to test-http-big-proxy-responses 2010-04-26 20:26:36 -07:00
Ryan Dahl
c6248efd73 Compile for beta versions of OpenSSL 1.0.0 2010-04-26 18:53:30 -07:00
Jérémy Lal
0802326fc9 test-dns so that NXDOMAIN does not rise errors 2010-04-26 15:09:03 -07:00
Jérémy Lal
5caf53a053 Add support for MX queries in dns module, works with c-ares upstream patch. 2010-04-26 15:09:03 -07:00
Jérémy Lal
14d1ab5a3e Apply unreleased upstream patch to support parse_mx_reply. 2010-04-26 15:09:03 -07:00
Jonas Pfenniger
df07a713bd New test-case: signal unregistration
The default signal-handler should be restored if no handlers are
assigned.
2010-04-25 23:14:07 -07:00
Ryan Dahl
cee9080381 Fix typos 2010-04-25 22:44:31 -07:00
Jérémy Lal
610faf713d Drop UDNS from node.uselib. Add CARES for --system. 2010-04-24 01:13:42 -07:00
Ryan Dahl
9926dacd14 Remove getaddrinfo from net2.cc 2010-04-23 17:29:36 -07:00
Ryan Dahl
3d6ebbd296 Don't look for GnuTLS in wscript 2010-04-23 17:24:37 -07:00
Ryan Dahl
c72967d335 Remove http_old tcp_old 2010-04-23 17:19:29 -07:00
Ryan Dahl
caa828a242 bump version 2010-04-23 16:37:14 -07:00
Ryan Dahl
bb4ae1769b Link to old versions 2010-04-23 16:37:14 -07:00
mape
b299b4b7a1 Update API doc 2010-04-23 16:37:10 -07:00
Ryan Dahl
16f02403f8 Catch errors from stream events in net.js
Pipe into 'error' event.
2010-04-23 14:08:54 -07:00
Ryan Dahl
e72b7b8002 Upgrade V8 to 2.2.4.2 2010-04-23 12:05:36 -07:00
Krishna Rajendran
7a34afba77 openssl 1.0.0 constification 2010-04-23 10:53:09 -07:00
Brian Hammond
40820ec8d5 Leave pos as undefined to allow reads from unseekable files like /proc/x/smaps on Linux 2010-04-23 10:34:10 -07:00
Ryan Dahl
c9e27b11c5 Unify ErrnoException creation 2010-04-22 17:53:45 -07:00
Ryan Dahl
0633e5cac9 Optimize for few args in EventEmitter.emit 2010-04-22 17:31:35 -07:00
Ryan Dahl
6abdf051d3 Unhandled 'error' events kill program
By default 'error' throws. addListener to prevent this.
2010-04-22 17:22:06 -07:00
Ryan Dahl
11f673e819 curl after server is listening 2010-04-22 15:48:57 -07:00
Ryan Dahl
76d525b034 Remove assert for no-such-module 2010-04-22 14:43:25 -07:00
Ryan Dahl
d70474dc10 SIGPIPE on stdout should kill the process by default 2010-04-22 14:25:13 -07:00
Ryan Dahl
3934cb5485 Force no body on http 204 and 304
Thanks to tjholowayhuk@gmail.com for the test case.
2010-04-21 15:15:21 -07:00
Ryan Dahl
94f9dc67c0 Add link to older tarball versions 2010-04-21 13:16:46 -07:00
isaacs
cfd459abde Move the module loading framework into lib/module.js. Minimal changes otherwise. 2010-04-21 12:05:01 -07:00
isaacs
e0061a511d refactor path module to lib/path.js 2010-04-21 11:38:51 -07:00
isaacs
7ff53f4c6a Refactor events module to lib/events.js 2010-04-21 11:38:46 -07:00
Herbert Vojčík
4badb227cf Fix TCP_KEEPIDLE build failure in FreeBSD. 2010-04-21 10:51:45 -07:00
Julian Lamb
5f8f561d61 add setKeepAlive function, which enables and sets the TCP keep-alive timer 2010-04-20 16:34:21 -07:00
Ryan Dahl
27ec33aad7 Add some libpaths for SSL 2010-04-20 14:44:05 -07:00
Michaeljohn Clement
ac9d9f4e9f better function test in addEventListener 2010-04-20 12:32:18 -07:00
Tim Caswell
61308a5bff Add a note in the API docs about binding to ports and using strings. 2010-04-19 15:52:51 -07:00
Tim Caswell
60de86351a Add Buffer.byteLength docs 2010-04-19 15:51:32 -07:00
Ryan Dahl
ff6409469d Make 'make distclean' work on solaris 2010-04-19 15:48:12 -07:00
Ryan Dahl
6e715b82d0 Upgrade Waf to 1.5.16 2010-04-18 19:57:13 -04:00
Standa Opichal
fa514a9f16 Do a manual check for openssl if 'pkg-config openssl' fails.
This makes the node_crypto module available for node built using just a
default OS X dev environment (no darwinports or fink).
2010-04-18 17:25:05 -04:00
Herbert Vojčík
8daa1f8d04 Docs for Script class of 'evals' binding. 2010-04-18 17:23:01 -04:00
Ryan Dahl
4ff45c264c Remove old EvalCX 2010-04-18 15:44:23 -04:00
Herbert Vojcik
c2a06725d6 Script class with eval-function-family in binding('evals') plus tests. 2010-04-18 15:01:36 -04:00
Matt Ranney
39464b498f Add docs for new REPL options and fill out description of commands. 2010-04-15 18:03:56 -07:00
Rhys Jones
3510669db2 Fixed ssl client and server examples 2010-04-15 20:03:55 +01:00
Rhys Jones
8efab857d0 Merge branch 'master' into openssl 2010-04-15 19:57:35 +01:00
Rhys Jones
e4a6b72ae3 Added test and started tidy-up of node_crypto.cc 2010-04-15 19:57:17 +01:00
Micheil Smith
6ad18a27a0 Fix upgradeHead bounds. 2010-04-15 11:19:54 -07:00
Rhys Jones
e6a1091cc6 Merge branch 'master' into openssl 2010-04-15 10:56:42 +01:00
Ryan Dahl
311d7dee19 bump version 2010-04-15 02:09:51 -07:00
Ryan Dahl
2ad587cc35 Default to UTF8 on stream write 2010-04-15 02:09:51 -07:00
Ryan Dahl
5281f29012 Use new method of getting chars written for UTF8 2010-04-15 02:09:51 -07:00
Ryan Dahl
d2e1b0855f Move two broken tests to disabled folder 2010-04-15 01:37:27 -07:00
Ryan Dahl
ac3bc2ed41 Simplify GC idle notification
In particular, don't leave the timeout running when the heap is fully
compacted.
2010-04-15 01:30:58 -07:00
Rhys Jones
d27d6dcc6f Merge branch 'master' into openssl 2010-04-15 06:21:15 +01:00
Rhys Jones
fbad5dc062 Updated https support 2010-04-15 06:17:22 +01:00
Ryan Dahl
4efe27bbab Add execFile() for Orlando
Undocumented for now, but basically like exec() with args.
2010-04-14 18:50:44 -07:00
Ryan Dahl
9cf2a02d8b Add timeout and maxBuffer options to child_process.exec 2010-04-14 11:59:24 -07:00
Ryan Dahl
41ef1717e0 Upgrade V8 to 2.2.3.1 2010-04-14 10:34:27 -07:00
Ryan Dahl
760bba5518 Support Upgrade in HTTP messages
This allows for web servers to be "hijacked" and used as Web Socket servers
(or other). You simply listen for requests as normal, but check if

  req.upgrade === true

If so, this will be the last request of the connection. It's your job now to
hijack req.connection and start reading from it. req.upgradeHead is a buffer
containing the first part of the new protocol communication (in the case it
arrived on the same packet).

This needs tests and documentation. API subject to change.
2010-04-14 03:52:15 -07:00
Ryan Dahl
af49187e57 Upgrade http-parser 2010-04-14 03:22:38 -07:00
Ryan Dahl
684740c232 net.js: Slice the right buffer in _writeOut 2010-04-14 00:41:56 -07:00
Ryan Dahl
b8c0349750 Fix triple buffer slice bug 2010-04-14 00:36:34 -07:00
Rhys Jones
144200435f Merge branch 'master' into openssl
Conflicts:
	lib/net.js
	wscript
2010-04-14 07:31:33 +01:00
Ryan Dahl
a934566eb9 Disable test-idle-watcher
IdleWatcher was disabled in a98d23d905
2010-04-13 16:57:19 -07:00
Ryan Dahl
b549b3fcce Fix test case style 2010-04-13 16:43:15 -07:00
Ryan Dahl
6732e7fa17 Add big proxy failing test
GH-77. Code by Robert Newson <robert.newson@gmail.com>
2010-04-13 16:22:14 -07:00
Ryan Dahl
71dc232f93 Use === instead of == for END_OF_FILE compares
This caused a very hard to track down bug. Thanks to Mikeal Rogers for this
fix. Unfortunately we were unable to put together a test case.
2010-04-13 15:56:08 -07:00
Ryan Dahl
a98d23d905 Disable IdleWatcher 2010-04-13 15:43:58 -07:00
Ryan Dahl
4e7e2f8724 Change nextTick implementation for the better
Use a prepare and idle watcher to execute the nextTick callback more
quickly. Test provided by Matt Ranney.
2010-04-13 15:43:46 -07:00
Ryan Dahl
57edff1f31 Remove mixin from docs 2010-04-13 13:50:17 -07:00
Ryan Dahl
b98cd6753b process.mixin: deprecation -> removed 2010-04-13 13:45:31 -07:00
Micheil Smith
57ea07ac91 Moving the http.js, net.js FreeList to being standalone. 2010-04-12 16:57:45 -07:00
Ryan Dahl
b7947e45c0 Recycle http client parsers 2010-04-12 16:34:39 -07:00
Ryan Dahl
1efd261572 doc typo 2010-04-12 16:27:04 -07:00
Matt Ranney
afe3c1cdea Buffer partial reads before doing expect match. 2010-04-12 14:38:16 -07:00
Rhys Jones
80174392bb Moved Credentials into crypto module. Added node_crypto into crypto module 2010-04-12 21:25:16 +01:00
Ryan Dahl
4681e34c1e Fix a race condition or two in net.js
When making a TCP connection, readyState returns 'opening' while resolving
the host. However between the resolving period and the establishing a
connection period, it would return 'closed'. This fixes it.

This change also ensures that the socket is closed before the 'end' event is
emitted in the case that the socket was previously shutdown.
2010-04-12 12:38:11 -07:00
Rhys Jones
45b8d24ea6 Added https server support 2010-04-12 20:36:46 +01:00
Rhys Jones
c9f71a807c Added https support 2010-04-12 18:57:22 +01:00
Tim Caswell
62d9852c3d Replace slow and broken for..in loops with faster for loops over the keys. 2010-04-12 10:34:35 -07:00
Matt Ranney
b7441040f8 REPL can be run from multiple different streams.
e.g. from UNIX sockets with socat.
2010-04-12 00:31:51 -07:00
Ryan Dahl
cc9d5ab546 C-Ares shouldn't iterate over all Object.prototype elements
and furthermore error out of one of them isn't a DNS option.

Test case by Ben Lund <ben.lund@gmail.com>; additional help from Tim Caswell
<tim@creationix.com>.
2010-04-11 16:12:20 -07:00
Matt Ranney
715e119eea Fix typo in comments. 2010-04-11 15:47:29 -07:00
Ryan Dahl
8553e8a15d Add incoming.httpVersion 2010-04-11 15:15:36 -07:00
isaacs
57fbb627ca trailing whitespace fixes 2010-04-11 14:48:23 -07:00
Ryan Dahl
93913dbdb8 Add failing test for HEAD requests
Needs to be fixed for 0.2.
2010-04-11 12:21:36 -07:00
James Herdman
dd50b86449 Fix documentation errors for DNS 2010-04-11 12:16:36 -07:00
Ryan Dahl
07e64d45ff bump version 2010-04-09 17:05:03 -07:00
Ryan Dahl
54f02345b5 Fix doc again 2010-04-09 16:52:10 -07:00
Ryan Dahl
ee3026797c More documentation work. Remove long lines 2010-04-09 15:34:08 -07:00
Ryan Dahl
03ea4b644e Improve(\?) docs 2010-04-09 14:51:20 -07:00
Micheil Smith
fd0bebcdbc Mods to the docs 2010-04-09 12:45:44 -07:00
Ryan Dahl
9331218449 Servers shouldn't die on EMFILE 2010-04-09 10:44:13 -07:00
Ryan Dahl
b36f11d7b5 Set old/new from benchmark script args 2010-04-09 10:42:20 -07:00
Tim Caswell
ff56d6364e Fix child_process to use end() instead of close() in the stdin stream. 2010-04-09 10:01:47 -07:00
Herbert Vojcik
06b9c8bf1f Fix of normalizing paths of form ./../the/rest 2010-04-09 08:01:36 -07:00
Ryan Dahl
a5184fe938 Change api.html style 2010-04-08 22:42:02 -07:00
Ryan Dahl
323a5e11e5 Change how events are represented in docs 2010-04-08 17:39:33 -07:00
Matt Ranney
631e5bf5cb Improve child_process documentation. 2010-04-08 16:31:36 -07:00
Ryan Dahl
08a09bb50a Use some more Binary/F methods for Buffer 2010-04-08 16:31:02 -07:00
Ryan Dahl
b8bb6e9007 Close child process stdin on SIGCHLD 2010-04-08 15:20:13 -07:00
Ryan Dahl
499c615c9e Doc changes for new API (part 1) 2010-04-08 15:00:08 -07:00
Felix Geisendörfer
b544185bd8 Fix doc toc for small screens
Only make the toc fixed position for big screens.
2010-04-08 14:20:43 -07:00
Felix Geisendörfer
1a9c9b0c55 Bring back the old manual style
This brings back the old manual style, including the toc and syntax
highlighting.
2010-04-08 14:20:33 -07:00
Ryan Dahl
50c70ac714 Update stream API: forceClose() -> destroy(), close() -> end() 2010-04-08 12:24:29 -07:00
Ryan Dahl
7faf7d5c8d Put file stream methods into prototype, small style fixes 2010-04-08 11:26:26 -07:00
Ryan Dahl
3819920d77 Rename binding reference in fs.js 2010-04-08 11:26:26 -07:00
Herbert Vojcik
c16508c87a Better require.async throw test 2010-04-08 08:17:58 -07:00
isaacs
de9778b5bd Add line breaks to the code when the user types a line break 2010-04-08 08:12:30 -07:00
Ryan Dahl
7a6b5635eb Revert "Enable TCP timeout by default"
Causing programs to not exit gracefully.

This reverts commit cb84cde4d4.
2010-04-08 07:19:42 -07:00
Ryan Dahl
62277ab79b Support both old and new HTTP closing APIs in benchmark program 2010-04-08 01:00:35 -07:00
Ryan Dahl
cb84cde4d4 Enable TCP timeout by default 2010-04-08 00:59:57 -07:00
Ryan Dahl
d923c94a0c Remove udns 2010-04-07 18:25:37 -07:00
Ryan Dahl
0281e1acf6 Fix benchmark script for testing both old and new version 2010-04-07 16:19:50 -07:00
Ryan Dahl
970e9025fe Remove debugging statements from dns_cares 2010-04-07 16:09:10 -07:00
Ryan Dahl
33e774eeba Use c-ares in lib/net.js 2010-04-07 16:05:07 -07:00
Ryan Dahl
8f671041a5 Check for ip address in dns_cares.lookup 2010-04-07 16:04:33 -07:00
Ryan Dahl
f13e2f96e4 Add a simple c-ares test, dns_cares.lookup() for easy resolv 2010-04-07 15:37:08 -07:00
Ryan Dahl
f56ff0de92 Add darwin-x86, linux-x86_64 c-ares headers 2010-04-07 13:39:11 -07:00
Ryan Dahl
9ea8c9f2b0 Clean up c-ares platform includes, add support for a few more 2010-04-07 13:34:40 -07:00
Ryan Dahl
eac3dc9d5f Bugfix: net.js flushing, _doFlush typo 2010-04-07 11:47:46 -07:00
Herbert Vojcik
d36bb6536e Better require.async tests 2010-04-07 11:47:45 -07:00
Vanilla Hsu
067f4086b6 add c-ares' freebsd support. 2010-04-07 09:36:35 -07:00
Ryan Dahl
888a494ad8 Update LICENSE file with C-Ares info 2010-04-07 01:45:20 -07:00
Krishna Rajendran
96df65e88e Make test-dns.js use dns_cares. 2010-04-07 01:29:20 -07:00
Krishna Rajendran
dc1f4ebd44 c-ares based dns module 2010-04-07 01:29:05 -07:00
Ryan Dahl
e9a116fe02 Include c-ares in deps/ 2010-04-07 01:17:49 -07:00
Vanilla Hsu
25adb2eb55 [FreeBSD] use /dev/null instead /dev/mem
Without this patch, Node needs to setgid kmem when run as normal user.
2010-04-06 22:05:12 -07:00
Ryan Dahl
38041fcaa0 Try out Flatten API
Speeds up WriteUtf8 significantly when dealing with strings made by the
concatenation of many others.
2010-04-06 16:15:09 -07:00
Ryan Dahl
ca0038bf2f Add mising EV_DEFAULT_UC in ev_now() 2010-04-06 15:23:42 -07:00
Vanilla Hsu
d7a4501057 freebsd install execinfo's header to /usr/local, add it to include path. 2010-04-06 10:23:43 -07:00
Ryan Dahl
53dd9fe200 Fix bug in buffer.utf8Write() which included \u0000 2010-04-05 18:10:36 -07:00
isaacs
4befe93a4b Add ini.stringify functionality, a test, and some TODOs in ini.js 2010-04-05 17:05:35 -07:00
Ryan Dahl
1b758ef268 Allow stream to write on close 2010-04-05 16:50:05 -07:00
Ryan Dahl
801fb8a614 Better, faster, idle notification 2010-04-05 14:04:14 -07:00
Ryan Dahl
0301adf9b4 In tests, wait for 'listening' before connecting 2010-04-05 11:32:18 -07:00
Ryan Dahl
b0d1d6c2b9 Reset stdin, stdout fd flags on exit
In vim, lauching node as a child process would mess up the screen. This was
because Node was changing the flags on STDIN_FILENO and STDOUT_FILENO
(particularly adding O_NONBLOCK) but those flags leaked into the parent
process.
2010-04-04 22:51:30 -07:00
Ryan Dahl
85487c82d0 Blob struct should not contain actual data
This is to allow eventual realloc without messing up the data_ references in
all the slices.
2010-04-04 21:37:08 -07:00
Ryan Dahl
01f7d4484e Upgrade to WAF 1.5.15 2010-04-04 21:12:25 -07:00
Ryan Dahl
ec0266a56c Update libev's clock when starting timers
Make the timeouts more accurate. See test/pummel/test-timers.js
2010-04-04 19:33:12 -07:00
Ryan Dahl
b72ffc0e07 Add buffer.copy 2010-04-04 18:59:40 -07:00
Ryan Dahl
cd577d503d Upgrade V8 to 2.2.0.3 2010-04-04 18:07:32 -07:00
Ryan Dahl
129310676d Fix style in SSL patch 2010-04-02 17:30:49 -07:00
Rhys Jones
c55c0a1fca Add SSL tests 2010-04-02 17:14:03 -07:00
Rhys Jones
fb3a9cd0d8 Initial openssl support for net2 2010-04-02 17:13:54 -07:00
Ryan Dahl
ae805f1057 Emit 'error' on tcp connection DNS error 2010-04-02 16:15:53 -07:00
Ryan Dahl
c0e18f37d4 Don't reference fixtures/multipart.js 2010-04-02 16:02:48 -07:00
Ryan Dahl
94644d743c Remove multipart library
Too messy, unmaintainable. Pull it out of the history if you need it.
2010-04-02 16:01:16 -07:00
Ryan Dahl
53530e981a Fix test-http-chunked. Need to check for \0 at end of utf8 strings 2010-04-02 14:55:28 -07:00
Ryan Dahl
b9106b0ecd Use AF_INET sockets instead of always AF_INET6
You can get AF_INET6 still, it's just not the only choice.
2010-04-02 13:20:56 -07:00
Ryan Dahl
fdae14070c Move buffer constants at the top of net.js
Remove some cruft.
2010-04-01 16:46:37 -07:00
Ryan Dahl
e232cf3100 Hack to support UTF8 writes again! 2010-04-01 16:24:36 -07:00
Ryan Dahl
3197cf291d Better flushing
Lost Utf8 support. Waiting for http://codereview.chromium.org/1539013
2010-04-01 15:53:48 -07:00
Tim Caswell
7af9cb9e80 Don't put an extra comma after bases in inspect.
{ [Function]     { [Function]
, more: true  =>   more: true
, more2: true    , more2: true
, more3: true    , more3: true
, more3: true    , more4: true
, more3: true    , more5: true
}                }
2010-04-01 08:58:19 -07:00
Ryan Dahl
4279725d79 Fix thread flags on Solaris
Also on other platforms use -pthread for compiling commands not just
linking because I noticed in the gcc(1) man page

  -pthread
      Adds support for multithreading with the pthreads library. This
      option sets flags for both the preprocessor and linker.

Removing the errno check in deps/coupling because it was a hack
(e165859c2e) added to fix stdio problems.
Without adding -threads, errno is not thread local, and coupling was not
correctly checking the errno. It appears -mt does nothing to gcc/solaris.
2010-03-31 13:44:36 -07:00
Ryan Dahl
d52f63d9b2 fix whitespcae in deps/coupling 2010-03-31 11:27:57 -07:00
Johan Dahlberg
18de108e4c Bugfix: watchFile, unwatch, watch causes error
Fixed bug that caused application to cast a "TypeError: Cannot call method
'addListener' of undefined" when first watching a file, unwatching and then
watching same file again.
2010-03-31 10:38:25 -07:00
Ryan Dahl
aec80d47bb Better check for FDs in net2 bindings 2010-03-31 08:20:59 -07:00
Herbert Vojcik
da16128bf6 missing return after forceClose 2010-03-31 08:13:03 -07:00
Herbert Vojcik
9e97e185ad EAI_NODATA deprecated, patch to use EAI_NONAME if missing (it is in FreeBSD) 2010-03-31 08:12:35 -07:00
Ryan Dahl
52b295400d Revert "Upgrade V8 to 2.2.0"
Experiencing strange errors on all platforms due to this commit. EG
http://buildbot.nodejs.org:8010/builders/Linux%20AMD64/builds/107/steps/shell_2/logs/stdio

This reverts commit 40ea061c30.
2010-03-29 16:42:39 -07:00
Matt Ranney
7c77a56b4a Improve documentation. 2010-03-29 11:23:27 -07:00
Ryan Dahl
40ea061c30 Upgrade V8 to 2.2.0 2010-03-29 01:04:53 -07:00
Ryan Dahl
d1b78c3f5d More efficient Stream.write 2010-03-27 14:07:43 -07:00
Ryan Dahl
aa6a785286 Add note about where to find ronn 2010-03-26 19:32:19 -07:00
Tim Caswell
179f718d62 Conversion to markdown based API docs.
With help from Matt Ranney <mjr@ranney.com>
2010-03-26 18:28:40 -07:00
Ryan Dahl
6ecdeada49 Remove -Werror on V8 -_- 2010-03-26 09:58:21 -07:00
Ryan Dahl
6192b8659a Upgrade V8 to 2.1.10 2010-03-26 09:09:40 -07:00
Ryan Dahl
bb00fef3cd Change Buffer.toString to conform to CommonJS Binary/F
Also add Buffer.inspect
2010-03-26 08:36:08 -07:00
Ryan Dahl
7ed80451ca Increase pool.used before making 'data' event 2010-03-26 08:35:12 -07:00
Ryan Dahl
a49bf8622f Finish V8 update 2010-03-25 15:01:59 -07:00
Ryan Dahl
48f5f77713 Update to V8 2.1.9.1 2010-03-25 09:53:58 -07:00
Ryan Dahl
6740dd48b3 Change Buffer toString() output 2010-03-25 09:50:49 -07:00
Ryan Dahl
3546106c43 Add req.connection and res.connection 2010-03-24 07:21:00 -07:00
Ryan Dahl
6f21ac1282 Don't free http parser for the client!
Fixes test-http-client-race.js, test-http.js
2010-03-23 21:41:42 -07:00
Ryan Dahl
5c6f063ef2 snake to camel in HTTP 2010-03-23 21:31:44 -07:00
Ryan Dahl
70ffdf5db9 Fix HTTP keep-alive 2010-03-23 21:10:01 -07:00
Ryan Dahl
6b6dcf4aad Move test-child-process-spawn-loop to pummel/ 2010-03-23 21:02:30 -07:00
Ryan Dahl
218d7e9f2d Clean up NODE_DEBUG detection
It wasn't detecting if NODE_DEBUG=0
2010-03-23 20:56:51 -07:00
Ryan Dahl
8e9ec4abea Fix idle timeouts
Remove process.now because it doesn't provide enough precision.
2010-03-23 20:54:19 -07:00
Ryan Dahl
3238944c7a Don't use sys.puts for debug in net.js 2010-03-23 18:10:13 -07:00
Ryan Dahl
a01d8a0d68 Timer clean ups
Also bugfix getting pointer to C++ class in watcher
2010-03-23 17:28:26 -07:00
Ryan Dahl
b35d72df76 Upgrade V8 to 2.1.7 2010-03-23 15:19:32 -07:00
isaacs
6e603ccbe2 Fix debug statement that was using puts instead of debug() 2010-03-23 08:54:05 -07:00
arlolra
6f84063a3b Migrates benchmarks to the new api. 2010-03-23 08:13:17 -07:00
Ryan Dahl
54d4efd44b Upgrade http-parser
Now at version 6f72c780f0a237a775150a9963bcdf5299685cde
2010-03-22 09:00:43 -07:00
Ryan Dahl
765f0cdece Fix ChildProcess::Kill 2010-03-22 05:06:13 -07:00
Ryan Dahl
bfdc421dda Don't kill negative PIDs
Fixes issue GH-79.
2010-03-20 03:01:17 -07:00
Ryan Dahl
069099a3e3 Remove old test file 2010-03-19 23:45:28 -07:00
Ryan Dahl
c66a0a739f recvBuffer -> pool 2010-03-19 23:09:16 -07:00
Ryan Dahl
cc053e7df7 Merge branch 'net2'
Expect instability on the master branch for a while.
Problems:
  - Documentation is not yet updated

  - SSL support is gone! It needs to be redone for net.js.  Use 'tcp_old'
    and 'http_old' if you need it. I want to use OpenSSL now, talk to me if
    you'd like to work on it.

  - fs.write() supports Buffers a little. See src/node_file.cc for details
    fs.read() not yet. The file streams need to be updated to handle Buffer.

  - The Buffer API will probably change.
2010-03-19 21:52:09 -07:00
Ryan Dahl
04001fb591 Don't deprecate readyState, yet 2010-03-19 21:51:07 -07:00
Ryan Dahl
ebe2721cbf Don't use sys.debug, it gets preprocessed out
Problem introduced in b29f78772e
2010-03-19 21:50:11 -07:00
Ryan Dahl
903977d5e8 Merge branch 'master' into net2
Conflicts:
	test/simple/test-event-emitter-modify-in-emit.js
2010-03-19 21:48:39 -07:00
Ryan Dahl
139c91e892 Support old 'binary' encoding in net.js 2010-03-19 21:25:29 -07:00
Ryan Dahl
663269f687 old tcp module is now tcp_old 2010-03-19 21:22:11 -07:00
Ryan Dahl
618296ef57 bump version 2010-03-19 21:07:03 -07:00
Ryan Dahl
025116f8d0 Move Buffer into own module 2010-03-19 20:58:24 -07:00
Zoka
b29f78772e Eliminate debug(x) statements from src/node.js and lib/*.js for release build
http://groups.google.com/group/nodejs/browse_thread/thread/8f20bcef6d6d96b7
2010-03-19 20:56:03 -07:00
Ryan Dahl
ac684f3583 Add legacy 'binary' encoding/decoding methods to Buffer 2010-03-19 20:33:09 -07:00
Ryan Dahl
b80f6e9ed1 http2 now default 2010-03-19 19:52:09 -07:00
Ryan Dahl
4278f35e89 Add support for Buffer to fs.write 2010-03-19 18:36:22 -07:00
Ryan Dahl
776c3e2b29 Add note about Buffer abstraction 2010-03-19 12:08:57 -07:00
Ryan Dahl
3a993d8897 Buffer.utf8ByteLength -> Buffer.byteLength 2010-03-19 12:02:59 -07:00
Ryan Dahl
3e969f0f74 Random net.js clean ups 2010-03-19 11:46:35 -07:00
Ryan Dahl
0c64768cb4 Don't error out when buffer.utf8Write() doesn't fit 2010-03-19 11:46:09 -07:00
Ryan Dahl
f8c3b6009d Remove send fd functionality
It was broken anyway. It will go into its own class later.
2010-03-19 11:34:26 -07:00
Ryan Dahl
e01464373f Speed up test-buffer 2010-03-19 11:30:51 -07:00
Ryan Dahl
90295d9fce [net2] inline write on empty write buffer for performance 2010-03-19 02:24:16 -07:00
Herbert Vojcik
9e8afe9133 DRY loading native module 2010-03-18 22:23:13 -07:00
Ryan Dahl
1762abcece http2 now passes all tests 2010-03-18 15:49:42 -07:00
Ryan Dahl
916e057fea Add 'opening' readyState 2010-03-18 14:33:42 -07:00
Carson McDonald
e5cbe73a82 Better EventEmitter modify-in-emit
Changed ReallyEmit so that it clones the Array of listeners before
processing the emit. Added better tests to make sure that modifying
listeners inside event handlers doesn't cause later listeners to be skipped
or added.
2010-03-18 14:08:20 -07:00
Ryan Dahl
33d5c46e8c All tests to use http2 2010-03-18 14:01:17 -07:00
Ryan Dahl
6db43f4c29 net2 HTTPClient work 2010-03-18 13:21:52 -07:00
Scott Taylor
39f0ef9d4a Remove duplicate shebang filtering 2010-03-18 07:56:54 -07:00
Tim-Smart
df8164c1c3 node.cc: EvalCX: Third argument as filename 2010-03-18 07:51:32 -07:00
Ryan Dahl
1332cafb7c s/Socket/Stream/g 2010-03-17 16:31:24 -07:00
Ryan Dahl
b865f9e9c8 Merge branch 'master' into net2 2010-03-17 16:24:43 -07:00
Ryan Dahl
2d7e86ef58 Upgrade V8 to 2.1.5 2010-03-17 15:52:57 -07:00
pyrotechnick
8aaffe71ee Fixing a typo in the fs.readFile example. 2010-03-17 14:44:15 -07:00
Ryan Dahl
04c06b9149 child process now use net.Socket 2010-03-17 14:00:17 -07:00
Krishna Rajendran
84277ea845 Check for callback argument in PTR lookup 2010-03-17 00:46:44 -07:00
isaacs
31ed37fdf0 evalcx shouldn't be too fancy
After getting some feedback from Mikeal Rogers and Tim Smart, it was decided
that evalcx should not try to do any fancy security stuff, and instead leave
that in the hands of the user. To comply more with spidermonkey, everything
is passed in, and objects are passed in by reference rather than being
cloned.
2010-03-16 20:09:13 -07:00
Ryan Dahl
217e4b40d4 Check for callback argument in DNS functions 2010-03-16 10:48:14 -07:00
Krishna Rajendran
3c97a4391a Update test-dns.js to work with latest api 2010-03-16 10:29:43 -07:00
Krishna Rajendran
3847add943 Fix calls to dns bindings in dns.js 2010-03-16 10:29:16 -07:00
isaacs
943b2c61a8 Make evalcx work like it's supposed to.
1. Move the context->Enter() call so that the global obj is available for writing.
2. On success, copy the modified global out to the sandbox object.
3. Don't copy functions in either direction.  They have scope and closures, and make for craziness when trying to keep contexts separate.
4. Only do the ->ToObject->Clone() on objects, so that simple values stay simple.
5. Update the test so that it tests all this stuff.
2010-03-16 10:27:47 -07:00
Ryan Dahl
953fa3a5f5 Move net2 bindings out of process 2010-03-15 16:44:50 -07:00
Ryan Dahl
5d5c8cf04a Fix StatWatcher typo 2010-03-15 15:53:44 -07:00
Ryan Dahl
fdf46a65c9 Use streams for stdout and stdin 2010-03-15 15:11:40 -07:00
Ryan Dahl
cbfd4da818 Merge branch 'master' into net2
Conflicts:
	src/node.cc
2010-03-15 14:34:01 -07:00
Ryan Dahl
6befc72f82 Add missing lib/events.js 2010-03-15 14:25:06 -07:00
Ryan Dahl
c90546f138 Move native js files into binding object 2010-03-15 14:24:15 -07:00
Ryan Dahl
8492c52e15 Use uniform watcher names 2010-03-15 14:24:15 -07:00
Ryan Dahl
627fb5adbb Load c++ modules on demand 2010-03-15 14:24:15 -07:00
Ryan Dahl
3994340a45 Fix gcc warnings in node.cc 2010-03-15 12:50:00 -07:00
Ryan Dahl
5c712a7da5 Lazy load fs.readFile 2010-03-15 10:41:58 -07:00
Ryan Dahl
1256df76bc remove whitespace 2010-03-15 09:02:52 -07:00
Ryan Dahl
d96c52694a Upgrade V8 to 2.1.4 2010-03-15 08:39:56 -07:00
Ryan Dahl
a6f904cab7 Tests should use compiled-in modules not build-dir modules 2010-03-15 08:14:51 -07:00
Ryan Dahl
1395cba6ce Remove require.paths from process object 2010-03-15 08:07:33 -07:00
Ryan Dahl
4ccdc501d4 Include lib/ directory in node executable. Compile on demand.
Instead of installing the files in /usr/lib/node/libraries and loading them
from the file system, the files are built-in to the node executable.
However, they are only compiled on demand.

The reasoning is:
  1. Allow for more complex internal javascript. In particular,
  process.stdout and process.stdin can be js implemented streams.

  2. Ease system installs. Loading from disk each time is unnecessary
  overhead. Note that there is no "system" path for modules anymore. Only
  $HOME/.node_libraries.
2010-03-15 08:04:35 -07:00
Krishna Rajendran
0d5a1fed33 Use gai_strerror when tcp.Server fails to resolve its address or service. 2010-03-14 23:08:45 -07:00
Jed Schmidt
004faf3846 Added check to make sure writeHead() is called before write(), to prevent silent failure. 2010-03-13 22:27:51 -08:00
Herbert Vojčík
49d30c6478 Only Ref in idle watcher when wasn't already active. 2010-03-13 20:45:26 -08:00
Ryan Dahl
7be0d06238 FreeBsd->Solaris on homepage 2010-03-13 12:47:41 -08:00
Scott González
d2ec5c23cf Fixed typo in comment for require.registerExtension(). 2010-03-13 12:29:33 -08:00
Ryan Dahl
ffeb4722d4 small wscript error 2010-03-13 12:20:09 -08:00
Ryan Dahl
61c8014135 bump version 2010-03-12 18:50:46 -08:00
Ryan Dahl
96f08cf05c Work on net2 http client 2010-03-12 18:39:02 -08:00
Ryan Dahl
c6ebfb0cc6 Merge branch 'master' into net2 2010-03-12 13:51:00 -08:00
Ryan Dahl
d7efb0fdb2 Factor out TryCatch in ReallyEmit 2010-03-12 13:48:03 -08:00
Ryan Dahl
2c7cbbc1b0 Optimize event emitter for single listener 2010-03-12 13:47:56 -08:00
Ryan Dahl
aa6eaae0aa Simplify Socket constructor 2010-03-12 13:06:05 -08:00
Ryan Dahl
b571900d9c Fix node_timer bug; sometimes was not initializing watcher 2010-03-12 12:56:10 -08:00
Ryan Dahl
c857d65dd3 Disable test-net-fd-passing for now 2010-03-12 12:43:28 -08:00
Ryan Dahl
28211519b6 Merge branch 'master' into HEAD
Conflicts:
	lib/fs.js
	wscript
2010-03-12 12:42:15 -08:00
Ryan Dahl
3adf7a3dcf TCP timeout opt-in instead of opt-out
For speed, idle connections are super cheap.
2010-03-12 12:39:37 -08:00
Ryan Dahl
b94af8d6b1 Only print readyState deprication message once 2010-03-12 12:34:25 -08:00
Ryan Dahl
836e6a3fcb Adjust object ref count after call to ev_timer_again 2010-03-12 12:27:41 -08:00
Ryan Dahl
177de8fefc Fix some gcc warnings 2010-03-12 12:21:27 -08:00
Ryan Dahl
3d10852c33 Disable AsciiSliceExt
Seems faster and less buggy?
2010-03-12 12:21:27 -08:00
Ryan Dahl
c1613e6ebb Deprecate process.mixin 2010-03-12 09:23:05 -08:00
Tim-Smart
ae10a48383 Initial implementation of process.evalcx 2010-03-12 08:22:48 -08:00
Ryan Dahl
6ec2f877c2 Depreciation -> Deprecation 2010-03-11 23:50:41 -08:00
Vanilla Hsu
b13081691e use getpagesize() to get PAGE_SIZE on FreeBSD. 2010-03-11 23:32:13 -08:00
Vanilla Hsu
116dfb8740 1: sync wscript with libeio.m4 2: try to enable macosx's sendfile. 2010-03-11 22:07:50 -08:00
Ryan Dahl
c96b7e5ca0 Missing EOL semicolons 2010-03-11 22:05:09 -08:00
Ryan Dahl
dd857f9fdf .addon -> .node
How'd that get in there?
2010-03-11 22:04:00 -08:00
Tim-Smart
0c17067d87 Add require.registerExtension 2010-03-11 22:00:55 -08:00
Ryan Dahl
6bd11f147a Fix undefined reference in fs.js 2010-03-11 14:32:10 -08:00
Ryan Dahl
ff2457754c Upgrade libeio 2010-03-11 14:31:51 -08:00
Jérémy Lal
c93bab141c Add --system option to configure, so make uses V8, EV, UDNS system libraries and headers. 2010-03-11 14:00:19 -08:00
Ryan Dahl
6d9227b79a Make relative ref to sys in fs module. 2010-03-11 12:48:47 -08:00
Ryan Dahl
ca862d75de [net2] Add Socket.setTimeout
Still seeing crashes and performance problems.
2010-03-11 12:43:32 -08:00
Ryan Dahl
4635ed7fde Add process.now
Faster way to find out current time.
2010-03-11 12:40:24 -08:00
Ryan Dahl
462a8f8652 add error listener to test-net-pingpong 2010-03-11 12:39:50 -08:00
Ryan Dahl
9b67962a44 Add timer.again method 2010-03-11 12:38:42 -08:00
Ryan Dahl
03f2bfe51f Make relative ref to sys in fs module. 2010-03-11 12:37:37 -08:00
Ryan Dahl
358b7516c7 Adjust process.compile documentation 2010-03-11 10:27:20 -08:00
isaacs
976983960d More ini parser features.
Update the ini parser to support some more whitespace cases, turn lines
without an equal sign into a "flag" that's just true if set, and support
comments.
2010-03-10 21:44:59 -08:00
Ryan Dahl
777e1a6c69 Merge branch 'master' into net2 2010-03-10 11:03:32 -08:00
Ryan Dahl
70b2a44579 Remove -Werror from V8 2010-03-10 11:03:26 -08:00
Ryan Dahl
7eb126474d Merge branch 'master' into net2 2010-03-10 11:02:01 -08:00
Ryan Dahl
073947c150 Upgrade V8 to 2.1.3 2010-03-10 10:50:46 -08:00
Ryan Dahl
0918bb2070 Adjust a few more tests to work with net2 2010-03-09 18:37:23 -08:00
Ryan Dahl
c1a0ade7e7 Further net2 compatibilities 2010-03-09 16:27:49 -08:00
Standa Opichal
c2c0cfb75f Making sure node-waf finds its real bindir even when executed through a symlinked path. 2010-03-09 13:05:44 -08:00
Ryan Dahl
b07f2e25f4 Update http2 for new stream API 2010-03-09 12:00:06 -08:00
Ryan Dahl
264a67aed2 Update net.js for new stream API 2010-03-09 11:59:42 -08:00
Ryan Dahl
dd21a4f4b9 Remove the 'Error: (no message)' exceptions print stack trace instead 2010-03-09 11:21:19 -08:00
Ryan Dahl
6310e717e4 Remove the 'Error: (no message)' exceptions print stack trace instead 2010-03-09 11:20:58 -08:00
Ryan Dahl
93c0c24a4e process.mixin: Return instead of continue in forEach 2010-03-09 10:54:26 -08:00
Ryan Dahl
c69d3f4a35 Don't use process.mixin in test-buffer.js 2010-03-09 10:54:01 -08:00
Ryan Dahl
faffee0c62 Merge branch 'master' into net2 2010-03-09 10:45:06 -08:00
Ryan Dahl
00333d59d6 process.inherits -> sys.inherits 2010-03-09 10:33:19 -08:00
Aaron Heckmann
f8eb163728 Add removeAllListeners 2010-03-09 09:30:14 -08:00
isaacs
b90d63b998 Change the include() message so that it doesn't recommend process.mixin. 2010-03-09 09:05:20 -08:00
isaacs
602d1861a1 Remove process.mixin from repl 2010-03-09 09:04:45 -08:00
Ryan Dahl
fb6dc11f11 Clean up some things in the benchmarks 2010-03-08 19:06:25 -08:00
Ryan Dahl
04999ef969 Remove -Werror from deps/v8/SConstruct
-_-
2010-03-08 18:04:59 -08:00
isaacs
c488e5775a Remove process.mixin dependencies from benchmark scripts 2010-03-08 17:57:38 -08:00
isaacs
a38aa02f9f Remove process.mixin dependency from fs 2010-03-08 17:57:08 -08:00
isaacs
5861db8a69 Remove process.mixin dependency from all tests. 2010-03-08 17:57:04 -08:00
Ryan Dahl
74614c1bf1 Change libev/wscript for waf 1.5.14 2010-03-08 17:45:57 -08:00
Ryan Dahl
5809483b78 Upgrade waf to 1.5.14a 2010-03-08 13:35:08 -08:00
Ryan Dahl
8c4561d2a0 Merge branch 'master' into net2 2010-03-08 11:14:11 -08:00
Ryan Dahl
c9c13e0718 require('fs') in test-http-tls 2010-03-08 11:13:24 -08:00
Felix Geisendörfer
39472709f0 fs.createWriteStream throws fs undefined error
The improved test suite now catches this bug, so hopefully thing like
this will not happen again.

See: http://github.com/ry/node/issues#issue/75
2010-03-08 10:22:19 -08:00
Felix Geisendörfer
44dde5f24c Remove fs/path globals from test suite
It is way too easy to not notice bugs due to those modules being
exported as globals while running the test suite.

See: http://github.com/ry/node/issues#issue/75
2010-03-08 10:20:07 -08:00
Ryan Dahl
e898c1f2e3 Upgrade WAF to 1.5.14 2010-03-08 10:18:24 -08:00
Ryan Dahl
c98b0799bf Upgrade V8 to 2.1.2.6 2010-03-08 09:33:11 -08:00
Ryan Dahl
40e42e8107 Replace --cflags with --vars 2010-03-08 09:10:24 -08:00
Felix Geisendörfer
9a9f08b1bc Add callbacks to stream methods
Allows for more fine graining, especially finding out about an individual
chunk of data being flushed in a write stream rather than the whole queue.

This commit also fixes a bug causing forceClose to fail on a readStream that
did not finish opening yet.
2010-03-08 09:05:56 -08:00
Felix Geisendörfer
c47391526c Fix typo in fs.writeStream docs 2010-03-08 09:05:31 -08:00
Ryan Dahl
209b219b10 Add environmental varibles to help text 2010-03-08 08:33:10 -08:00
Ryan Dahl
d67fdcc177 clean should not docclean 2010-03-07 12:13:16 -08:00
Rasmus Andersson
374300ca8d Updated patch of node.cc for supporting reading of umask 2010-03-07 12:07:57 -08:00
Ryan Dahl
681733d905 Merge branch 'master' into net2 2010-03-05 20:51:26 -08:00
Ryan Dahl
a258992855 Depreciation process.unloop() 2010-03-05 18:07:28 -08:00
Ryan Dahl
39b63dfe17 bump version 2010-03-05 17:55:13 -08:00
Ryan Dahl
b9cd3363ef Bugfix in querystring 2010-03-05 17:07:02 -08:00
Rob Ellis
5c78c45fa3 Added Parse INI to Node, tests 2010-03-05 16:17:57 -08:00
Ryan Dahl
939a6c7484 Clean up homepage 2010-03-05 16:02:06 -08:00
Ryan Dahl
e72b072d53 Decouple timer from EventEmitter 2010-03-05 15:31:26 -08:00
Ryan Dahl
6d60d2db00 Revert "Use kqueue on macintosh"
Experiencing bugs http://github.com/ry/node/issues/#issue/74

This reverts commit 409020a67d.
2010-03-05 14:36:13 -08:00
Ryan Dahl
5217eda1ae Merge remote branch 'felixge/file2' 2010-03-05 11:11:23 -08:00
Felix Geisendörfer
dbf9e466bc Documentation for FileWriteStream 2010-03-05 20:04:19 +01:00
Felix Geisendörfer
a96b5c792e Documentation for FileReadStream 2010-03-05 19:54:28 +01:00
Felix Geisendörfer
78c61000c2 Properly handle read errors
Also set readable to false if the initial fs.open call failed.
2010-03-05 19:53:59 +01:00
Felix Geisendörfer
145fac2b56 Use sys inherits
Also use events.EventEmitter instead of process.EventEmitter.
2010-03-05 19:24:20 +01:00
Felix Geisendörfer
0fcc94525a Renamed fileReadStream -> createReadStream
Did the same for fileWriteStream as well.
2010-03-05 18:56:25 +01:00
Felix Geisendörfer
48562fa938 Updated file streams
Read streams now only support forceClose()

Write streams support close() and forceClose()
2010-03-05 18:43:29 +01:00
Felix Geisendörfer
b4fba5fe8e Simplify buffering
There is no way more than one read event would be buffered.
2010-03-05 18:43:29 +01:00
Felix Geisendörfer
f6e00759ef Initial read stream implementation 2010-03-05 18:43:28 +01:00
Felix Geisendörfer
9415ca909e Use process.mixin instead of sys.mixin
The process namespace has not been cleaned up yet, so mixin is still
attached to process.
2010-03-05 18:42:32 +01:00
Ryan Dahl
e6dbf8d632 Revert "Remove process.unloop()"
People need this for backwards compatibility. Will be removed soon though!

This reverts commit 1e710cafa7.
2010-03-04 13:00:37 -08:00
Ryan Dahl
1e710cafa7 Remove process.unloop() 2010-03-04 11:51:39 -08:00
Ryan Dahl
409020a67d Use kqueue on macintosh 2010-03-04 10:02:41 -08:00
Ryan Dahl
d5ee777af2 Don't allow child process to clobber environ 2010-03-03 15:34:57 -08:00
Ryan Dahl
d1500cee6e Store connection in OutgoingMessage 2010-03-03 13:06:19 -08:00
Ryan Dahl
9d4d232eaa Factor out a http.Client._reconnect() function 2010-03-03 12:49:06 -08:00
Ryan Dahl
64d0e328e8 Remove unused EventEmitter object 2010-03-03 12:41:31 -08:00
isaacs
0dba38eef0 Fix a bug that was suppressing the error in setgid, allowing it to fail silently. 2010-03-03 10:57:01 -08:00
Ryan Dahl
769a35024f Allow passing env to child process 2010-03-03 10:45:58 -08:00
Jacek Becela
548d59d07e Fix fs.readFile handling encoding. Should close issue #72 2010-03-03 10:28:33 -08:00
Ryan Dahl
0e844d3bcb tcp.Connection.prototype.write should return boolean 2010-03-02 21:16:17 -08:00
Rasmus Andersson
5c602b750a Rewrote realpath implementation solving all known failing tests (also added a bunch of new test cases) 2010-03-02 17:35:34 -08:00
Ryan Dahl
9be3df0828 Add sys.log() 2010-03-02 17:35:01 -08:00
Felix Geisendörfer
18a70ffda1 Tweaks
- Add 'writeable' property
- Renamed pump->flush
- Use sys.mixin instead of process.mixin
2010-03-02 23:29:54 +01:00
Felix Geisendörfer
61785afb3d Initial write stream implementation 2010-03-02 23:29:54 +01:00
Ryan Dahl
7881b59f6b Merge branch 'master' into net2 2010-03-02 13:20:07 -08:00
Ryan Dahl
6670154819 'make test' only runs the simple test 2010-03-02 13:18:59 -08:00
Ryan Dahl
776b099d75 Disable ipv6 test on solaris 2010-03-02 21:10:05 +00:00
Ryan Dahl
62c4214711 Properly throw error on failed connection 2010-03-02 20:59:47 +00:00
Ryan Dahl
e165859c2e Fix coupling error on Solaris
Was getting a lot of

  push_pump read(): Resource temporarily unavailable

Apparently Solaris can return read() < 0 but errno == 0 to indicate a
EAGAIN?
2010-03-02 20:39:38 +00:00
Ryan Dahl
7bd3280cc2 process.inherits -> sys.inherits in net.js 2010-03-02 10:59:19 -08:00
Ryan Dahl
d9e3b466a7 Merge branch 'master' into net2 2010-03-02 10:44:25 -08:00
Ryan Dahl
fdbc9a82e4 Use EVBACKEND_SELECT on Solaris
Using EVBACKEND_PORT DTraceToolkit-0.99/Proc/syscallbypid.d reports after 5
seconds

   PID CMD                      SYSCALL                     COUNT
     . .                        .                               .
     . .                        .                               .
     . .                        .                               .
 28551 mysqld                   fcntl                         485
 24793 httpd                    gtime                         528
 28551 mysqld                   read                          707
 28551 mysqld                   gtime                         956
 21050 rsync                    pollsys                       965
 21050 rsync                    read                          965
 24793 httpd                    read                          982
 28551 mysqld                   lwp_sigmask                  1422
  4675 dtrace                   ioctl                        1579
 15136 node                     portfs                      15681
 15136 node                     clock_gettime               31358

On a very simple node process.
2010-03-02 10:39:07 -08:00
Rasmus Andersson
20d5963fae Added fs.realpath and fs.realpathSync (pure javascript versions) 2010-03-01 19:14:24 -08:00
Ryan Dahl
7a251f3bdf Fix shebang in wscript 2010-03-01 19:14:14 -08:00
Felix Geisendörfer
55ab9b4541 Bug fix for deep process.mixin array handling
process.mixin was throwing an exception when trying to do a deep copy
of an object that included an array.

This bug was introduced in: 3bb7ad6fea
2010-03-01 14:13:57 -08:00
Benjamin Thomas
6034701f57 Stop sys.inspect from adding extra new lines for deep objects that are elements in an array.
A couple other small fixes:

If the keys of an object were all numeric they should be quoted. This
way, you can now hypothetically copy and paste the output into your code
(if the object doesn't contain any circular objects, deeply nested
objects, Dates, RegExps or functions. I think).

If a nested object isn't being recursed into, output "[Object]" as
opposed to "[object Object]".

If an object is longer than the max width but it is one line no matter
what, then don't put the closing brace on a new line.

Fix some formatting issues to try and match Node's style guidelines.
2010-03-01 13:34:46 -08:00
Ryan Dahl
b021a845f7 Move process.inherits to sys 2010-03-01 11:39:35 -08:00
Ryan Dahl
30b700ee22 Move watchFile into fs module 2010-03-01 10:42:37 -08:00
Ryan Dahl
810882c1ad Move 'fs' module out of src/node.js into its own file 2010-03-01 10:14:49 -08:00
Ryan Dahl
faa0c6d449 Add note about testing patches with debug build 2010-03-01 09:11:04 -08:00
kriskowal
2b91f8d265 Fixed spurious suffixes on fs.readlink. 2010-02-27 21:33:27 -08:00
arlolra
724ccf10df Tests on common port. 2010-02-26 12:20:10 -08:00
Ryan Dahl
16e32c8fd9 Allow for net reconnects 2010-02-26 12:13:49 -08:00
Ryan Dahl
71d237e6a0 Move net2 tests into test/simple 2010-02-26 12:13:33 -08:00
Ryan Dahl
c6cc386819 Merge branch 'master' into net2 2010-02-26 11:34:24 -08:00
Zoran Tomicic
b2995829e1 Edit PrintHelp() text 2010-02-26 00:30:43 -08:00
Ryan Dahl
c219571eac Use more beautiful object syntax in docs 2010-02-25 18:59:02 -08:00
arlolra
3497da370b Decoupled readdir test. 2010-02-25 18:49:10 -08:00
Benjamin Thomas
de1521413e Make the output of sys.inspect a lot more compact.
See:
http://groups.google.com/group/nodejs/browse_thread/thread/ac060521e27fef65

By default now, sys.inspect doesn't recurse more than two times.  Pass
in null as the third parameter to make it recurse indefinitely.
2010-02-25 18:23:11 -08:00
Benjamin Thomas
a2714be8b5 Add optional third argument sys.inpect to indicate how many times you want it to recurse 2010-02-25 13:17:05 -08:00
Benjamin Thomas
b1b84960ce Rename writeHeader to writeHead 2010-02-25 13:01:21 -08:00
Ryan Dahl
b08f2af344 Update common.js path for new test layout 2010-02-25 12:01:23 -08:00
arlolra
04fac19822 Split tests. 2010-02-25 11:41:11 -08:00
Karl Guertin
9ad7539cf9 Add (unused) callback parameter to fs.readFile, fs.writeFile 2010-02-24 14:46:30 -08:00
Jonas Pfenniger
8f59cccb75 Removed deprecation errors in src/node.cc
Removed constness on string litterals. This should cause no problem
since we're not modifying them.
2010-02-24 13:16:52 -08:00
Ryan Dahl
e0ecf4f8f5 Remove -Werror on V8
Are they ever going to fix this?
2010-02-23 22:58:54 -08:00
Ryan Dahl
b80bdda14e Upgrade V8 to 2.1.2 2010-02-23 17:52:50 -08:00
James Duncan
df1c1e593f Add setgid,getgid 2010-02-23 14:45:02 -08:00
Ryan Dahl
4fd0225e41 Give signal handlers maximum priority 2010-02-23 13:08:04 -08:00
Ryan Dahl
c5b149ab1e Add hack to get error event on socket timeout
See
http://groups.google.com/group/nodejs/browse_thread/thread/4898a1ed3b99dcf0
2010-02-23 13:05:15 -08:00
Rasmus Andersson
b57d946184 added fs.link, fs.symlink, fs.readlink
including sync versions and complete tests
2010-02-22 19:23:06 -08:00
Ryan Dahl
a97fdf5c39 Merge branch 'master' into net2 2010-02-22 14:22:20 -08:00
Ryan Dahl
f0f2d2ee70 Fix readdirSync in docs 2010-02-22 14:04:54 -08:00
Ryan Dahl
dc041628ce Add not about nextTick and setTimeout(fn, 0) 2010-02-22 13:58:48 -08:00
Jérémy Lal
ffb4b47367 Fix for when EV_MULTIPLICITY=1 2010-02-22 13:25:57 -08:00
Ryan Dahl
46ebaa00ce Encoding 0 length data, returns '' instead of null 2010-02-22 12:07:07 -08:00
Ryan Dahl
b8dee2eb20 camel case variables in url module 2010-02-22 06:49:14 -08:00
Ryan Dahl
bb0d1e65e1 bump version 2010-02-22 01:31:14 -08:00
Ryan Dahl
6ee0bf704a Fix dns bug - first cb arg wasn't null 2010-02-22 01:26:40 -08:00
Ryan Dahl
e8363abb6a delete changelog.html on 'make docclean' 2010-02-21 23:13:40 -08:00
Ryan Dahl
05ae932a0e Implement fs.readdirSync() 2010-02-21 23:06:08 -08:00
Benjamin Thomas
49cd1bbf84 Fix bug in process.mixin where deep copies would not work at all.
Before, doing this:

    var sys = require("sys");

    var obj = {
      one: 1,
      two: 2,
      three: {
        value: 3
      }
    };

    sys.p(process.mixin(true, {}, obj));

Would output this:

    {
     "two": 2,
     "three": {
      "one": 1,
      "two": 2,
      "three": {
       "value": 3
      },
      "value": 3
     },
     "one": 1
    }

When it should have outputed this:

    {
     "one": 1,
     "two": 2,
     "three": {
      "value": 3
     }
    }
2010-02-21 22:51:23 -08:00
Ryan Dahl
4c8889bba2 Revert "Add fs.readdirSync()"
Doesn't work on Linux.

This reverts commit 05d6da6c4a.
2010-02-21 21:53:35 -08:00
isaacs
9acc8a686a Expose fs.lstat 2010-02-21 21:43:45 -08:00
Zoran Tomicic
d98ea70168 Configurable debug ports, and --debug-brk 2010-02-21 21:17:25 -08:00
Ryan Dahl
12d78cd1df Rename sendHeader to writeHeader; allow reasonPhrase 2010-02-21 16:53:49 -08:00
Micheil Smith
05d6da6c4a Add fs.readdirSync() 2010-02-21 16:32:20 -08:00
Ryan Dahl
c094dda53c Move errors for readPause and readResume 2010-02-21 16:01:12 -08:00
Ryan Dahl
7a8ede6f80 Add note about Promise removal 2010-02-21 15:48:43 -08:00
Scott González
6eff8937d7 Fixed encoding in fs.writeFile(). 2010-02-21 10:35:48 -08:00
Jeremy Ashkenas
2916a2acd4 Remove '--' from command line parsing 2010-02-20 22:47:49 -08:00
Ryan Dahl
a0c48eecab Rename readPause and readResume to pause/resume 2010-02-20 22:38:42 -08:00
Ryan Dahl
1db824a9c1 Add changelog to website 2010-02-20 22:30:56 -08:00
Tim Caswell
68af59ef6b Fix typo in fs.writeFile 2010-02-20 21:03:03 -08:00
Ryan Dahl
ea4956f046 Simplify call to V8::IdleNotification
Run a max priority ev_timer every 2 seconds. If there aren't any pending
watchers then call V8::IdleNotification() once. This is slower at freeing
memory, but I think simpler and less aggressive.
2010-02-20 20:36:33 -08:00
Ryan Dahl
0485cc41d5 Remove promises 2010-02-20 19:49:00 -08:00
Ryan Dahl
7a51184420 Multipart test no longer depend on Promise 2010-02-20 19:44:47 -08:00
Ryan Dahl
5fbc750db7 multipart no longer depends on Promise 2010-02-20 19:17:58 -08:00
Ryan Dahl
daacb81d3a Experimental idle garbage compact 2010-02-20 18:23:21 -08:00
Ryan Dahl
fcda5e8dfa If ab isn't installed skip keep-alive test 2010-02-19 18:54:25 -08:00
Rasmus Andersson
860fcf23f4 skipping TLS test if node was not compiled with TLS 2010-02-19 18:35:35 -08:00
Ryan Dahl
de7016eac5 sys.exec() no longer uses Promise 2010-02-19 16:55:46 -08:00
Ryan Dahl
c04b679e12 'dns' no longer uses Promise 2010-02-19 16:41:08 -08:00
Ryan Dahl
d0f2d465aa http.cat no longer uses Promise 2010-02-19 16:26:48 -08:00
Ryan Dahl
ef55324f1a Do not use Promise in 'fs' module 2010-02-19 16:02:30 -08:00
Ryan Dahl
662fdfed37 fs.closeSync should return Undefined on success 2010-02-19 16:02:14 -08:00
Ryan Dahl
375131376f Module loading no longer depends on Promise
The module loading code is looking extremely messy. It needs a refactor.
2010-02-19 11:59:05 -08:00
Ryan Dahl
bcf163da27 Upgrade V8 to 2.1.1 2010-02-19 10:40:48 -08:00
Ryan Dahl
764783560e Remove Promise.prototype.wait()
I don't want users to have to think about coroutine safety.

http://thread.gmane.org/gmane.comp.lang.javascript.nodejs/2468/focus=2603
2010-02-19 10:19:46 -08:00
Ryan Dahl
860d008d54 Truly synchronous require()
This is to reduce our dependency on wait(). For some reason this patch
affects the timer test:

  % ./node test/mjsunit/test-timers.js
  diff: 989
  diff: 989
  diff: 1989
  diff: 2989

Previously it showed:

  % ./node test/mjsunit/test-timers.js
  diff: 1000
  diff: 1000
  diff: 2000
  diff: 3000

I'm not sure what caused this change, and it's rather disturbing. However I
want to remove wait() as soon as possible and so am pushing this patch
through.

The module loading code is becoming increasingly ugly - this patch has not
helped. A refactor needs to be done soon.
2010-02-19 10:06:49 -08:00
Ryan Dahl
ca02b4f586 Fix AUTHORS again
I hope I won't spend all my time now maintaining this file...
2010-02-18 16:46:20 -08:00
Ryan Dahl
c5de1b6350 fix email in AUTHORS 2010-02-18 10:17:19 -08:00
Rasmus Andersson
3bb7ad6fea fixed process.mixin to properly copy getters/setters 2010-02-18 10:17:13 -08:00
Micheil Smith
bcc032e43a Adding interface between node and libeio for Chmod. 2010-02-18 10:13:57 -08:00
Ryan Dahl
cb32883537 Add authors file 2010-02-17 22:43:28 -08:00
Ryan Dahl
c2e58c9dee Remove a few wait() calls in the tests 2010-02-17 21:28:31 -08:00
Ryan Dahl
4f01c74e9f Fix long lines in docs 2010-02-17 18:41:56 -08:00
Ryan Dahl
7811fa6fec Update example on index.html 2010-02-17 17:07:08 -08:00
Ryan Dahl
07423f3a87 Merge branch 'master' into net2 2010-02-17 15:46:30 -08:00
Ryan Dahl
7c1c89fc29 Update benchmark script to new API 2010-02-17 15:37:12 -08:00
Ryan Dahl
916d592be1 Fix 'make website-upload' 2010-02-17 15:20:09 -08:00
Ryan Dahl
87d5e5b316 bump version 2010-02-17 15:12:42 -08:00
Ryan Dahl
217b60a272 sed -i 's/git-/git /g' Makefile 2010-02-17 15:07:44 -08:00
Ryan Dahl
0314a10e10 Clean up and rename test-stat-handler 2010-02-17 14:30:50 -08:00
Ryan Dahl
92292c8394 Rename a few remaining fs.cat calls. 2010-02-17 14:00:53 -08:00
Ryan Dahl
0b823dce61 Add /opt/local/lib as a search path for gpg-error
Why doesn't WAF just search LD_LIBRARY_PATH?
2010-02-17 13:56:47 -08:00
Ryan Dahl
c622142692 Add note about gnutls and libgpg-error in installation instructions 2010-02-17 13:39:03 -08:00
Ryan Dahl
d9b0eb3922 Remove references to wait() in docs 2010-02-17 13:29:25 -08:00
Ryan Dahl
df94c763ae documentation clean up 2010-02-17 13:14:34 -08:00
Ryan Dahl
f57b0e993b Add asciidoc-xhtml11.js for use with asciidoc 8.5.1 2010-02-17 12:48:14 -08:00
Ryan Dahl
5013bf1781 API: OutgoingMessage.prototype.finish() renamed to close() 2010-02-17 11:10:10 -08:00
Tim Caswell
6115df6338 File API tweaks
- Rename fs.cat to fs.readFile
- Move file.write to fs.writeFile
- Allow strings for the flag argument to fs.open
  ("r", "r+", "w", "w+", "a", "a+")
- Remove the unused 'File' module / class
2010-02-16 23:55:53 -08:00
Ryan Dahl
ae85d9af97 API: Make request/response object closer to stream interface
- sendBody() renamed to write()
- 'body' event renamed to 'data'
- 'complete' event renamed to 'end'
2010-02-16 22:16:29 -08:00
isaacs
46a47d2799 Add some puts() to test-multipart.js to show what it's doing. 2010-02-16 21:18:02 -08:00
Ryan Dahl
5468173ce9 [debug] Give debug_watcher maximum priority 2010-02-16 19:45:12 -08:00
Ryan Dahl
4322523fcf [debug] Use ProcessDebugMessage() instead of executing empty script
And don't use --debugger_auto_break v8 flag, it seems unnecessary.
2010-02-16 19:45:01 -08:00
Jérémy Lal
5a08a5653c Calculate page size with getpagesize for armel 2010-02-16 16:16:01 -08:00
Ryan Dahl
ecd61742a1 Throw from connection.connect if resolving.
Bug reported by James Golick.
2010-02-16 14:38:51 -08:00
Ryan Dahl
23cf502db7 API: connection.send() renamed to connection.write() 2010-02-16 13:18:42 -08:00
Ryan Dahl
1bf46d1536 Revert "Add process.startTime"
Unnecessary

This reverts commit 896cef23c4.
2010-02-16 09:32:25 -08:00
Zoka
fbef11b679 Use InstanceTemplate() instead of PrototypeTemplate() for accessor methods
This fixes crash that used to happen when Eclipse debugging session hits the
breakpoint that is set either in timer or connection callback.
2010-02-16 09:04:19 -08:00
Felix Geisendörfer
490cac0d7e Fix Promise.wait() for fired promises
Failure introduced in 80ace36e4c
2010-02-15 17:24:07 -08:00
Jonas Pfenniger
80ace36e4c Added failing test: promise.wait() after promise.emitXXX() 2010-02-15 17:22:13 -08:00
Ryan Dahl
95fd370096 Remove unused variable 2010-02-15 17:15:40 -08:00
Yuichiro MASUI
1793ee1c80 Fixed: promise late chain 2010-02-15 17:12:40 -08:00
Mark Hansen
98e61db216 sys.inspect(Date) now shows the date value 2010-02-15 17:08:22 -08:00
visionmedia
9c6263bff8 Added multiple arg support for sys.puts(), print(), etc. 2010-02-12 10:43:07 -08:00
Ryan Dahl
b82ef28d9d Rename 'posix' module to 'fs' 2010-02-12 01:04:14 -08:00
Ryan Dahl
896cef23c4 Add process.startTime 2010-02-12 00:47:35 -08:00
Ryan Dahl
bc17d94a0a API: tcp events 'receive' to 'data', 'eof' to 'end'
No deprecation messages. Not sure how...
2010-02-12 00:25:19 -08:00
Ryan Dahl
7d428a7741 s/tinyclouds.org/nodejs.org/ 2010-02-12 00:08:26 -08:00
Ryan Dahl
b20c343a7a Fix whitespace and warnings in node.cc 2010-02-11 21:55:08 -08:00
Felix Geisendörfer
211e82e8d9 Simple test case for require.async()
This is to make sure this doesn't break after implementing the new
truly sync require() function.
2010-02-11 21:45:03 -08:00
Felix Geisendörfer
6c94b8e4e4 Implemented posix.catSync() 2010-02-11 21:11:16 -08:00
Ryan Dahl
1b42276851 Small clean up to test-timers.js 2010-02-11 15:51:46 -08:00
Ryan Dahl
cd41e30bcc Return chunk & bytes read for posix.readSync() 2010-02-11 15:17:32 -08:00
Felix Geisendörfer
b02b54e003 Fix: Module cache did not propagate
This patch makes sure nested modules are available in their parents
cache. The module simplification broke this behavior.

See:

http://groups.google.com/group/nodejs/browse_thread/thread/e875132469547d2
b73f61a137
2010-02-11 11:23:19 -08:00
Ryan Dahl
dc01587c6c Merge branch 'master' into net2 2010-02-10 14:05:29 -08:00
masuidrive
3337e9da1a Build system: support spaces in directory names 2010-02-10 07:42:16 -08:00
Michael Stillwell
9f6f19df1b Add test: modifying event listeners during callback. 2010-02-09 14:47:37 -08:00
Ryan Dahl
3eaaaffadb Ignore EAGAIN in stderr dumps.
(Going out of the way to be sync)
2010-02-09 14:45:14 -08:00
Ryan Dahl
88b9359284 Fix stderr flushing problem 2010-02-09 14:11:58 -08:00
Ryan Dahl
49de41ef46 bump version 2010-02-09 13:20:20 -08:00
Tim Caswell
3aca908db3 Document the changes to sys.inspect's API.
It now takes an optional showHidden argument that shows hidden/non-enumerable properties of objects.

Also cleanup the lib/sys.js file a bit.
2010-02-09 09:20:15 -08:00
Tim Caswell
e33c66654a Rewrite sys.inspect to be more reliable and handle crazy edge cases. 2010-02-09 08:57:38 -08:00
isaacs
3adcdfc2e1 A rewrite of multipart library.
1. Support streaming in the simple case.  Put huge warnings around the
buffering API.
2. Support nested multipart messages.
3. Support various kinds of multipart messages, including all the various
absurdities of multipart email messages.
4. Error out on various invalid types of data that might come through.
5. Gracefully several edge cases that occur when the chunk size is smaller
than the boundary length, or cuts into the \r\n, etc.
6. Provide both positive and negative tests.
2010-02-08 14:03:06 -08:00
Ryan Dahl
4234ac53e2 Use Google's jsmin.py so that Node can be used for evil 2010-02-08 13:52:13 -08:00
Ryan Dahl
b6edae5671 Expose errno exception creation 2010-02-08 07:36:40 -08:00
Michael Carter
a38607605c Add process.setuid(), getuid() 2010-02-07 22:13:10 -08:00
Ryan Dahl
6f92d8f3b0 Add handlescope and flush to process.reallyExit() 2010-02-07 21:59:56 -08:00
Ryan Dahl
ae1fc497bb Fix stdout flush issue
http://github.com/ry/node/issues#issue/53
2010-02-07 21:56:36 -08:00
Ryan Dahl
a695065305 Add failing test for stdout flush on exit 2010-02-07 18:05:58 -08:00
Ryan Dahl
76c1805c67 Add posix.truncate() 2010-02-07 17:18:28 -08:00
Ryan Dahl
77145ba229 Throw errors from server.listen() 2010-02-07 16:51:20 -08:00
Ryan Dahl
979f5889d5 Optimize: Use callbacks instead of events in net2 2010-02-05 20:14:48 -08:00
Ryan Dahl
d979a7993e Wrap syscalls with try-catch 2010-02-05 19:47:16 -08:00
Ryan Dahl
263813ae3e Whitespace for node_net2.cc 2010-02-05 19:34:27 -08:00
Ryan Dahl
8fdb39a4ae Add errno symbol to error messages 2010-02-05 19:26:55 -08:00
Ryan Dahl
96f42745ff Merge branch 'master' into net2 2010-02-05 19:00:26 -08:00
Matt Brubeck
1737cdc112 Fix the documentation of dns error handling.
These are actually passed as Error objects, not separate "code" and "message"
parameters.
2010-02-05 18:23:32 -08:00
Ryan Dahl
fe85062046 Bugfix: blocked pumping in stdio coupling
This should fix the test in c05b5d8 by Mikeal Rogers.
2010-02-05 17:14:14 -08:00
Mikeal Rogers
c05b5d8b59 Adding test for bug in stdio.
http://groups.google.com/group/nodejs/browse_thread/thread/10fda8eaf7276642/e5d5147f2b666abd
2010-02-05 10:58:00 -08:00
Felix Geisendörfer
b73f61a137 Simplified module system
createModule got removed as it was unnecessary and caused issues by
doing its own cache checks independent of loadModule. Internal modules
are now the only globally cached modules, all other modules are only
cached by inheriting their parent modules cache.

Credits: Module specific cache and a few other diffs by Blaine Cook

431662d25c
http://romeda.org/blog/2010/01/hot-code-loading-in-nodejs.html
http://thread.gmane.org/gmane.comp.lang.javascript.nodejs/1994
2010-02-04 14:08:39 -08:00
Ryan Dahl
e5a41a75b7 Revert "Adding output of Platform information into the test runner"
Broken on at least one platform http://pastie.org/808217

This reverts commit 704f394c66.
2010-02-03 12:57:05 -08:00
Ryan Dahl
0cfa789cc5 bump version 2010-02-03 12:20:27 -08:00
Ryan Dahl
f3ad635576 Downcase process.ARGV/ENV to process.argv/env 2010-02-03 12:19:21 -08:00
Aaron Heckmann
8f52142116 look for -1 instead of false returned from string.indexOf 2010-02-03 10:13:15 -08:00
Ryan Dahl
173a8c9842 Disable dns and fs-sendfile tests. 2010-02-03 10:05:24 -08:00
Ryan Dahl
0b07f32819 Merge branch 'master' into net2 2010-02-03 10:00:39 -08:00
Ryan Dahl
c7cb4daa25 Upgrade V8 to 2.1.0 2010-02-03 09:07:02 -08:00
Ryan Dahl
1660db6b87 Inline Buffer::HasInstance 2010-02-02 19:35:06 -08:00
Ryan Dahl
c723acc721 Remove some HandleScopes from HTTP
for a %2.5 improvement in hello world HTTP score.
2010-02-02 18:45:18 -08:00
Ryan Dahl
7c9919f810 Remove some unnecessary handlescopes 2010-02-02 18:37:14 -08:00
Ryan Dahl
ce4204a069 Upgrade http-parser
Fixes, among other things, a header overflow attack.
2010-02-02 16:40:59 -08:00
Ryan Dahl
987441283b Callbacks from process.fs always start with error object 2010-02-02 11:04:59 -08:00
Ryan Dahl
33509bdbe5 eof -> end 2010-02-01 18:19:14 -08:00
Ryan Dahl
4f56d8ae24 Rename Buffer.utf8Length to Buffer.utf8ByteLength 2010-02-01 13:10:37 -08:00
Ryan Dahl
fc025f878a Remove __wrap__s 2010-01-31 11:13:30 -08:00
Ryan Dahl
9f5643f427 Reorganize the start-up process
- assign 'GLOBAL' (and now 'global') inside src/node.js

- position for eventually allowing replacements to src/node.js for people
  like Kris Kowal who want the nice libev and libeio bindings but not
  necessarily node's choices of modules or promises.
2010-01-30 23:22:34 -08:00
Jonas Pfenniger
7a755e04a9 Was using the old node object to get the int from the constant. 2010-01-30 20:58:24 -08:00
Micheil Smith
704f394c66 Adding output of Platform information into the test runner 2010-01-29 23:46:56 -08:00
Felix Geisendörfer
ac2abe5b1e Bugfix: Handle Content-Type headers with charset
Some HTTP clients include a charset parameter in the Content-Type, e.g:

multipart/form-data; charset=utf-8; boundary=0xKhTmLbOuNdArY

This patch makes the multipart parser more forgiving towards unexpected
information included in the Content-Type header.
2010-01-29 18:04:48 -08:00
Ryan Dahl
785531691b Add buffer.unpack 2010-01-29 09:57:47 -08:00
Ryan Dahl
49451c1dab Merge branch 'master' into net2 2010-01-29 00:58:43 -08:00
Ryan Dahl
344243db92 Simplify send buffer logic 2010-01-28 19:13:13 -08:00
Ryan Dahl
aadce8e1a9 Optimize, clean up net2 net.js and http2.js 2010-01-28 14:31:57 -08:00
Ryan Dahl
c328f3e6c6 Add new http server library 2010-01-28 11:17:21 -08:00
Ryan Dahl
4347906b7f Fix require() in test-buffer.js 2010-01-27 18:45:07 -08:00
Ryan Dahl
b06dda1f5e ObjectWrap fixed - buffers working!
Hot bug fix from net2 branch.
2010-01-27 18:33:15 -08:00
Ryan Dahl
b93b09a877 ObjectWrap fixed - buffers working! 2010-01-27 18:23:35 -08:00
Ryan Dahl
e82893d3f2 Clean up IOWatcher 2010-01-27 16:07:15 -08:00
Ryan Dahl
bf803f478b Reimplment Buffers 2010-01-27 15:40:09 -08:00
Standa Opichal
5a70224081 Adding OS X .dmg build scripts.
Simply place this into the root of your nodejs git working copy and
run ./tools/osx-dist.sh. It will create an dist-osx folder which will
comprise of the resulting .dmg file (install path is
/usr/local/nodejs with symlinks added to /usr/local/bin) along with
other files used during its construction.

$ ls -1 dist-osx/
nodejs-v0.1.26-11-gcd6397c
nodejs-v0.1.26-11-gcd6397c.dmg
nodejs-v0.1.26-11-gcd6397c.pkg
nodejs-v0.1.26-11-gcd6397c.plist

The resulting installed package is going to be visible using the
OS X 'pkgutil --packages' command. You can even safely uninstall
sudoing 'pkgutil --unlink org.nodejs.NodeJS-...' and subsequently
let the system forget about the package being ever seen by
'pkgutil --forget org.nodejs.NodeJS-...'.

Here is the current package ID I have installed:

$ pkgutil --pkgs | grep node
org.nodejs.NodeJS-v0.1.26-11-gcd6397c

Use this patch freely without hesitation.

Signed-off-by: Standa Opichal <opichals@gmail.com>
2010-01-27 14:12:31 -08:00
Ryan Dahl
1bb52947e0 Forgot to include fix from HTTP client bug (30b0522) 2010-01-27 10:00:46 -08:00
Ryan Dahl
30b0522157 Bugfix: HTTP client automatically reconnecting
Test case by tlynn.
2010-01-27 09:34:45 -08:00
Ryan Dahl
a668d07484 Clean up http_parser binding - add asserts 2010-01-26 18:37:16 -08:00
Ryan Dahl
824a2fd1c6 Clean up a few bugs in net.js 2010-01-26 18:36:24 -08:00
Ryan Dahl
c106c3740b Use ObjectWrap again for IOWatchers.
I think the problem is in Buffers.
2010-01-26 18:35:01 -08:00
Ryan Dahl
b8c3d715fd use efence again 2010-01-26 18:34:42 -08:00
Ryan Dahl
ccd632f278 Simplify ObjectWrap; make fewer Weak callbacks 2010-01-26 12:00:17 -08:00
Ryan Dahl
741e3fa91b HTTP works somewhat on net2 now
However it's not working very well: Hitting a 'hello world' server with many
requests (ab -t 60 -c 10) will cause it to crash with the following error.

  Obtained 3 stack frames.

  ./node(_Z11print_tracev+0x1c) [0x80d1b3c]
  ./node(_ZN4node6Parser7ExecuteERKN2v89ArgumentsE+0x69) [0x80d3759]
  ./node [0x811f44b]
  TypeError: Already parsing a buffer
      at Socket.<anonymous> (/home/ryan/projects/node/lib/http2.js:393:20)
      at IOWatcher.callback (/home/ryan/projects/node/lib/net.js:81:12)
      at node.js:985:9
      at node.js:989:1
2010-01-25 17:55:08 -08:00
Blaine Cook
cd6397cc45 Add support for MX, TXT, and SRV records in DNS module. 2010-01-25 09:03:27 -08:00
Ryan Dahl
c420c89dbd Make assert.AssertionError instance of Error 2010-01-24 14:39:32 -08:00
cloudhead
3669c75f4d removed inline require call for querystring 2010-01-24 14:25:31 -08:00
Felix Geisendörfer
c86c614cac Bug Fix: Late promise promise callbacks firing
Late promise bindings would fire regardless of the outcome of the
promise.

Test case by: Jonas "zimbatm" Pfenniger <jonas@pfenniger.name>
2010-01-24 14:20:17 -08:00
Ryan Dahl
dda1d681f7 Provide buffer in HTTPParser callbacks. 2010-01-24 14:12:15 -08:00
Ryan Dahl
bffa18befc Expose buffer_root() 2010-01-24 14:06:07 -08:00
Ryan Dahl
42ee16978e Implement new http-parser binding using Buffer 2010-01-24 11:21:45 -08:00
Joseph Pecoraro
c99e33bc90 Fix minor issues in the documentation. 2010-01-24 00:00:27 -08:00
David Sklar
6f738d6e7a Adjust passing-FDs test to wait until socket is really writeable 2010-01-22 14:37:30 -08:00
Felix Geisendörfer
a76c7a89ce Implemented __dirname
It seems that the current __filename module global is mainly used to
determine the directory the current module is in. To make that
easier, this patch adds support for a __dirname module global
directly.
2010-01-22 10:10:15 -08:00
Ryan Dahl
5547450ca5 credit Erich in ChangeLog 2010-01-20 16:33:20 -08:00
Ryan Dahl
2788064bc2 Make callback_symbols static so they don't conflict 2010-01-20 15:43:06 -08:00
Ryan Dahl
653bf580bf Merge branch 'develop' into net2
Conflicts:
	src/node.cc
2010-01-20 15:24:38 -08:00
Jonas Pfenniger
971f43d63b FIX: Promise timeout should not addErrback
Because now, we expect the exception to be thrown if no errback
is given, we can't let timeout() add an errback silently.
2010-01-20 15:01:03 -08:00
Jonas Pfenniger
87d92f619a FIX: EventEmitter call in Promise 2010-01-20 14:59:38 -08:00
Jonas Pfenniger
7f652b63a9 Factorized deprecation messages 2010-01-20 14:58:05 -08:00
Ryan Dahl
fe48b5faa4 Fix author in ChangeLog 2010-01-20 13:48:35 -08:00
Ryan Dahl
da00413196 bump version 2010-01-20 11:28:32 -08:00
Ryan Dahl
f88d39de74 getmem() for solaris 2010-01-20 11:19:17 -08:00
Ryan Dahl
faefb3f5a4 test-http-eof-on-connect missing require('./common') 2010-01-20 10:06:44 -08:00
Ryan Dahl
152d956deb Remove -Werror from V8 2010-01-20 09:39:03 -08:00
Felix Geisendörfer
b57d7d9b4e Treat 'typeof Error' promise errors properly
Instead of JSON encoding them, just rethrow promise errors since that
produces much cleaner error messages.
2010-01-20 09:30:56 -08:00
Ryan Dahl
0c1255453e Initial Solaris support 2010-01-19 16:51:27 -08:00
Ryan Dahl
e60d653a58 Upgrade V8 to 2.0.6.1 2010-01-19 15:45:36 -08:00
Felix Geisendörfer
bfd3144861 Make unhandled Promise errors throw an exception
A promise will throw an exception unless an error handler is attached in the
same "tick" that the error is emitted. This is to avoid silent promise
failures.
2010-01-19 14:29:57 -08:00
Felix Geisendörfer
f64371fccb Support late callback binding for Promises
Listeners attached with addCallback / addErrback will now be executed
right away if the promise has already fired.
2010-01-19 14:29:49 -08:00
Felix Geisendörfer
d9dc2e0709 Fixed misnamed Promise property 2010-01-19 14:29:44 -08:00
Felix Geisendörfer
f2274840a9 Removed Promise.cancel()
The current implementation was bad and nobody is using it. Has a chance
of getting re-implemented by somebody who has an actual need for it.
2010-01-19 14:29:38 -08:00
Michaeljohn Clement
4e16e386fe set default encoding in sendBody 2010-01-19 12:43:19 -08:00
Micheil Smith
6e3d12f617 Allow optional params to setTimeout, setInterval 2010-01-18 10:41:03 -08:00
Ryan Dahl
8abeffa9ea Add process.nextTick()
This is a replacement for the common hack:

  setTimeout(cb, 0);

It's much more efficient.
2010-01-18 10:32:36 -08:00
Ryan Dahl
aeb7d6d168 Add process.IdleWatcher
With priorities. Will be used for process.nextLoop().
2010-01-18 10:12:04 -08:00
Joseph Pecoraro
820ca71a91 Updated out of date LICENSE file. 2010-01-18 09:11:26 -08:00
Joseph Pecoraro
fd183bdb07 Fixed typo in comments. 2010-01-18 09:11:02 -08:00
Ryan Dahl
70293a43c9 API: Move Promise and EventEmitter into 'events' module 2010-01-15 12:46:08 -08:00
Ryan Dahl
8e6dd52683 Hack to display more useful SyntaxError exceptions.
For some reason v8 doesn't include the frame with the syntax error in the
stack trace - so have to special case it.
2010-01-15 10:45:04 -08:00
Vanilla Hsu
6c5c808569 use SUN_LEN to calculate length of unix address @ FreeBSD. 2010-01-15 09:41:33 -08:00
Ryan Dahl
df59f06734 recvMsg shouldn't return array for efficiency. 2010-01-13 08:41:04 -08:00
Ryan Dahl
02e52ef8e9 Merge branch 'master' into net2 2010-01-12 16:59:14 -08:00
Ryan Dahl
c4397b801a Make sure GNUTLS is first on uselib
Why? Because I have two versions of GnuTLS installed - one is old 2.0.X in
/usr and one is new 2.5.X in ~/local/gnutls. waf correctly finds that the
newer version, but because GNUTLS was behind other libraries in the
node.uselib -L/usr/lib was before -L/home/ryan/local/gnutls/lib in the
actual gcc command - hence getting link errors. WAF SUCKS, really.
I wish someone would invent a good build system that could avoid such
problems.
2010-01-12 01:09:58 -08:00
Ben Williamson
a3631a383b Added regression test for issue #44 2010-01-11 16:43:23 -08:00
Ryan Dahl
f379b77735 Error out when no compiler found 2010-01-11 16:43:10 -08:00
Ryan Dahl
8e0dad4a27 Update http benchmark script to new url api. 2010-01-10 23:00:58 -08:00
Ryan Dahl
1b2c57907d Lazy initialize symbols for HTTP. 2010-01-10 22:27:48 -08:00
Ben Williamson
bba23c0998 Fix issue #44, eof on connect to http.
eof_symbol wasn't initialized until the first packet arrived.
In this case no packets arrive before the client closes the socket - eof.
2010-01-10 22:22:21 -08:00
Ryan Dahl
39ca93549a bump version 2010-01-09 02:11:54 -08:00
Ryan Dahl
c9e21435c0 Upgrade http-parser 2010-01-09 01:52:49 -08:00
David Sklar
a876df6c71 Initial take on passing FDs between processes 2010-01-09 01:28:19 -08:00
isaacs
b3349eb33a Documentation for path module changes. 2010-01-09 00:38:05 -08:00
isaacs
988174a629 Add tests for path module. 2010-01-09 00:31:51 -08:00
isaacs
b21056d63a Rename path.filename() to path.basename()
Also make normalizeArray a bit more proper wrt handling dots when keepBlanks
is enabled. Fix indentation.
2010-01-09 00:26:49 -08:00
Benjamin Thomas
73266cb486 Added extname function to path module that returns the extension. 2010-01-08 22:28:27 -08:00
Ryan Dahl
53413598b6 Fix another problem with the EIO interface
Should call eio_poll() when given a done_poll signal as well.

Bug report and test case by Kris Zyp <kriszyp@gmail.com>
2010-01-08 22:20:23 -08:00
Ryan Dahl
75e6c39733 Upgrade http-parser
Fixes \n problem that psanford <pms.mail@gmail.com> reported.
2010-01-07 18:36:28 -08:00
Vanilla Hsu
d22952bfe0 getmem for freebsd 2010-01-06 23:37:27 -08:00
Ryan Dahl
1b9eaf43f5 Update node-waf version to 1.5.10 - to match tools/wafadmin 2010-01-06 17:12:22 -08:00
Benjamin Thomas
947c577c0d Fix bug in the url module's url_parse method if 'parseQueryString' is true 2010-01-06 02:12:11 -08:00
Ryan Dahl
b1e126f415 libeio bugfix part 4
Oops. Last commit broke a few tests. Should work now!
2010-01-06 01:53:34 -08:00
Ryan Dahl
f80cc69c23 libeio bugfix part 3
Finally (hopefully) fix the issue that Felix reported. It's only appearing
on macintosh (test/mjsunit/test-eio-race3.js)

The trick/hack is to call eio_poll() again before reentering the event loop.

Additionally this commit implements a more complex method of calling
eio_poll(), occasionally dropping to an ev_idle watcher.

See also:
3f39772834
http://lists.schmorp.de/pipermail/libev/2010q1/000855.html
http://groups.google.com/group/nodejs/browse_thread/thread/9f8db11c792a68bb/a89705f68971f53c
2010-01-06 01:27:31 -08:00
Ryan Dahl
3f39772834 libeio bugfix part 2
Reverts the change to deps/libeio/eio.c added in
04dd2d51be
It wasn't a bug, I was just using eio incorrectly.

See http://lists.schmorp.de/pipermail/libev/2010q1/000855.html
2010-01-05 21:09:02 -08:00
Felix Geisendörfer
d9085ea0cb Updated docs for multipart errors 2010-01-05 20:15:16 -08:00
Felix Geisendörfer
7d947f8723 Clean up multipart test case 2010-01-05 20:15:03 -08:00
Felix Geisendörfer
f86c1783b7 Handle bad requests in simplified parser API 2010-01-05 22:37:51 +01:00
Felix Geisendörfer
aa73ed973c Added test case for the simple multipart API
So far this didn't have any test coverage.
2010-01-05 22:28:03 +01:00
Felix Geisendörfer
d9a81374b2 Throw exception for invalid multipart streams
When using the multipart parser with an regular http request, the
parser did not complain and just never finished.
2010-01-05 22:23:56 +01:00
elliottcable
52f088b966 Providing the option for a repl-printer other than sys.p 2010-01-05 00:14:03 -08:00
Ryan Dahl
04dd2d51be libeio bugfix: want_poll should be called if breaking on maxreq
Reported by shansen and hassox
http://github.com/ry/node/issues#issue/38

Will send upstream.
2010-01-04 23:26:58 -08:00
Ryan Dahl
933a37cd28 Upgrade libev to 3.9 2010-01-04 22:52:48 -08:00
Ryan Dahl
af6c177b91 Upgrade libeio to latest CVS 2010-01-04 22:46:32 -08:00
Charles Lehner
caf22c8e0a Fixed clearTimeout to check if timer is a Timer 2010-01-04 22:18:06 -08:00
visionmedia
a650138ebf Moved help msg to node-repl 2010-01-04 22:06:18 -08:00
isaacs
2b3d9e4ad0 Use "url" module instead of "uri" module in http.js.
Deprecate the URI module and remove tests for it.
- Rename "uri" to "url".
- Use the "url" module instead of the "uri" module.
- Remove the url parsing from http.js
- Update http.cat with the changed field names.
- Update tests for changes to http.js
- Update documentation for changes in http.js
2010-01-04 21:22:46 -08:00
isaacs
7ff04c1f86 Add URL and QueryString modules, and tests for each.
Also, make a slight change from original on url-module to put the
spacePattern into the function.  On closer inspection, it turns out that the
nonlocal-var cost is higher than the compiling-a-regexp cost.

Also, documentation.
2010-01-04 21:03:54 -08:00
isaacs
d6fe7fb4c3 Documentation for path module 2010-01-04 20:58:16 -08:00
isaacs
7342fecaec Improve path module slightly:
1. Provide a switch to tell it to not remove empty path parts when
   normalizing.
2. Correct the handling of some edge cases when you have lots of dots and
   empty bits, such as paths like "././/./..//." and so on.
2010-01-04 11:36:52 -08:00
Tim Caswell
fd184ee2fa Rename "Dynamic Property" to "Getter/Setter" in sys.inspect. 2010-01-03 21:15:21 -08:00
Tim Caswell
6c68a9679b Fix inspect to not trigger dynamic properties
but to display them as special. Add unit tests to match
2010-01-02 18:18:01 -08:00
Tim Caswell
732c6f2036 Fix inspect for the special case of an Object that inherits from Array, but has other properties. 2009-12-31 09:57:29 -08:00
Ryan Dahl
642c2773a7 bump version 2009-12-31 00:30:53 -08:00
Ryan Dahl
9553503be5 Bugfix: Don't segfault on unknown http method
Reported by Chakrit Wichian.
2009-12-30 22:16:16 -08:00
Ryan Dahl
d9757520fb Merge branch 'master' into net2 2009-12-30 16:37:36 -08:00
Ryan Dahl
8fd46a34d6 Kill -Werror in V8 for GCC 4.4.1 users.
http://code.google.com/p/v8/issues/detail?id=413
2009-12-30 12:59:02 -08:00
Ryan Dahl
20eec646b3 [net2] add unix server to ping-pong test 2009-12-30 11:51:43 -08:00
Ryan Dahl
8d0f756158 [net2] delete unix sockfile on server start and shutdown 2009-12-30 11:32:07 -08:00
Ryan Dahl
a8ede8dd9e [net2] port ping pong test 2009-12-30 10:58:46 -08:00
Ryan Dahl
0d31e9875f [net2] socket.setNoDelay 2009-12-30 10:43:47 -08:00
David Sklar
de9bfdea8e [net2] toRead() for non-linux (SIOCINQ -> FIONREAD) 2009-12-30 10:06:40 -08:00
Ryan Dahl
402755b14a Add socket.address() 2009-12-30 00:57:55 -08:00
Ryan Dahl
2582560f91 [net2] Do hostname lookups in connect and listen 2009-12-30 00:53:14 -08:00
Ryan Dahl
1beb840fec Back to 64kb stack size - enlarging it was a typo 2009-12-30 09:01:28 +01:00
Ryan Dahl
8330316014 Fix errors in getaddrinfo 2009-12-30 08:53:19 +01:00
Ryan Dahl
2c016badc2 'make distclean' should not call 'waf clean'
Because if configure hasn't been run, then an error is reported.
2009-12-30 02:50:06 +01:00
Ryan Dahl
fd73a3a398 Upgrade V8 to 2.0.5.4 2009-12-30 02:35:15 +01:00
Ryan Dahl
07333a4ab0 [net2] Set FD_CLOEXEC on created socket fds. 2009-12-29 21:12:32 +01:00
Ryan Dahl
48ccbb9afa [net2] lower-case socket.type 2009-12-29 21:12:32 +01:00
Ryan Dahl
25700e65ee [net2] Better EOF marking, rename events 2009-12-29 21:12:32 +01:00
Ryan Dahl
153b755936 Change IOWatcher constructor to have no arguments 2009-12-29 21:12:32 +01:00
Ryan Dahl
6e5abf4551 implement getaddrinfo 2009-12-29 21:12:31 +01:00
Ryan Dahl
0618f02f6f Implement half-closed streams 2009-12-29 21:12:31 +01:00
Ryan Dahl
3fce98c853 Add Stream.prototype.connect() and test-net-server.js 2009-12-29 21:12:31 +01:00
Ryan Dahl
b23ed4a98c Rename new streaming code to 'net' 2009-12-29 21:12:31 +01:00
Ryan Dahl
bddd6e9ca3 Implement stream.send() 2009-12-29 21:12:31 +01:00
Ryan Dahl
1da15d623e Fix buffer bug, implement tcp recv 2009-12-29 21:12:30 +01:00
Ryan Dahl
0ecd0fa598 IOWatcher callback isn't internal, fix bug in Accept 2009-12-29 21:12:30 +01:00
Ryan Dahl
469e2648e5 More bindings, beginning tcp server code in js 2009-12-29 21:12:30 +01:00
Ryan Dahl
c819abccb6 Start on net2 2009-12-29 21:12:30 +01:00
Ryan Dahl
f219938b69 add io watcher 2009-12-29 21:12:29 +01:00
Ryan Dahl
3377a30fb8 Move cb_persist functions out of dns module 2009-12-29 21:12:29 +01:00
Ryan Dahl
e2569c402f Add some tests to test-buffer.js 2009-12-29 21:12:28 +01:00
Ryan Dahl
630bb7a012 Rename blob to buffer. 2009-12-29 21:12:28 +01:00
Ryan Dahl
0afed52329 initial blobs 2009-12-29 21:12:28 +01:00
Ryan Dahl
359d0170ab Better error message on bad ARGV[1] 2009-12-29 20:31:56 +01:00
Ryan Dahl
53a841d96a Simplify exception reporting 2009-12-29 20:20:51 +01:00
Ryan Dahl
0accebe583 Stack trace for asserts shouldn't include assert module 2009-12-29 20:15:05 +01:00
Ryan Dahl
dd35637603 Fix assert.js code style 2009-12-29 20:10:59 +01:00
Ryan Dahl
0d7e88a429 Bugfix: libeio race condition
Process at most 10 pending responses from the thread pool in one go.
10 was chosen arbitrarily.
Test and report by Felix Geisendörfer <felix@debuggable.com>
2009-12-29 19:11:04 +01:00
Michaeljohn Clement
3d24e119e0 don't chunk responses to HTTP/1.0 clients, even if they send Connection: Keep-Alive (e.g. wget) 2009-12-23 22:24:29 +01:00
Ryan Dahl
64fe9fb85d fix whitespace 2009-12-22 23:11:54 +01:00
Ryan Dahl
f91e347eee bump version 2009-12-22 20:31:45 +01:00
Felix Geisendörfer
5de04dafc6 Do not pause request for multipart parsing
This is actually undesireable as it takes away control from the user who
may want to pause/resume to throttle the upload stream, or synchronize
it with disk flushing.

I actually ran into memory issues when trying to stream huge files to
disc as the file module was building up a huge action buffer. This can
now easily be avoided like this:

part.addListener('body', function(chunk) {
  req.pause();
  file.write(chunk).addCallback(function() {
    req.resume();
  });
}
2009-12-22 19:28:30 +01:00
Jonas Pfenniger
e6c5ac4f73 posix.cat not using call() correctly
'this' will point to "arguments" and the arguments of the callback itself
will not be set.
2009-12-22 18:01:13 +01:00
Ryan Dahl
120492e5c2 export path.normalizeArray for the uri module 2009-12-22 17:50:23 +01:00
isaacs
4dcdfaf929 Fix require("../blah") issues
Added some more tests, and refactored the uri and path modules to use the
same normalization logic, so that nothing is relying on flaky regexps.

http://groups.google.com/group/nodejs/browse_thread/thread/34779f8c10098c5e
http://groups.google.com/group/nodejs/browse_thread/thread/1aa0146b92582679#msg_9822c03998cb4064
2009-12-22 17:22:12 +01:00
Ryan Dahl
a2d809fe90 bump version 2009-12-19 01:24:59 +01:00
Ryan Dahl
a98afdfb2f Revert "Upgrade V8 to 2.0.5"
This reverts commit 20b945df70.

Broken on Hagen's Macintosh. Don't have time to investigate.
2009-12-19 01:04:19 +01:00
Ryan Dahl
0981e7f663 Fix test-readdir.js
Was broken because I added "throws_error.js" to the fixtures directory.
Problem appeared in bfa36136da.
2009-12-19 00:45:01 +01:00
isaacs
0ea2f9e04b Remove two debug statements that are a bit much. 2009-12-19 00:14:50 +01:00
isaacs
6301f18e62 Bugfix: child modules get wrong id with "index.js"
Fix for bug brought up by nua in irc, where child modules get the wrong id
when loaded from a parent module with an id of index.js or index.addon.
2009-12-19 00:14:10 +01:00
isaacs
c2454a0d06 Inadvertently introduced a bug in how single-dot path parts are handled. 2009-12-19 00:13:20 +01:00
isaacs
3b8e47755a Bugfix: require("../foo")
If you have a circular require chain in which one or more of the modules are
referenced with a ".." relative path, like require("../foo"), node blows up.
This patch un-blows-up that case.  There still seem to be issues with
circularity, but this solves one of the more obnoxious ones.
2009-12-19 00:12:38 +01:00
Ryan Dahl
bfa36136da require() should throw error if module does.
Reported by Kris Zyp
http://groups.google.com/group/nodejs/browse_thread/thread/1feab0309bd5402b
2009-12-18 23:58:04 +01:00
isaacs
4526308560 Update to fix failing test. Rewrite of the resolveObject function, and some tweaks to format. 2009-12-18 19:02:27 +01:00
isaacs
f65b36eec1 Use the new uri parser. 2009-12-18 19:02:16 +01:00
isaacs
4a615ddd9c Add credits, and a "decode" function. 2009-12-18 18:59:02 +01:00
isaacs
2f9722cca0 Pull in the uri.js from Narwhal and create tests, stripping out the cruft from a previous code-surgery. 2009-12-18 18:56:59 +01:00
visionmedia
f3b0cefd0b Replaced several Array.prototype.slice.call() calls with Array.prototype.unshift.call()
Acts in pretty much the same manor just a bit more elegant
2009-12-18 18:42:20 +01:00
Joshaven Potter
7873639f55 syntax fixes in src/node.js 2009-12-18 16:21:21 +01:00
Micheil Smith
d8e69d31b3 Documentation for the assert module 2009-12-18 16:17:10 +01:00
Ryan Dahl
22d1d3dbf7 Fix kqueue check (broke it in last commit) 2009-12-18 15:45:53 +01:00
Rasmus Andersson
6eb8bbc640 note about why execinfo detection fails on Darwin even though it exists 2009-12-18 15:37:24 +01:00
Ryan Dahl
fa667f718c Fix check for epoll_ctl(). Was broken on Linux 2009-12-18 15:36:25 +01:00
Rasmus Andersson
752da03eb0 detect nanosleep on OS X and do not look for functions in libraries we know dows not exist 2009-12-18 15:36:11 +01:00
Rasmus Andersson
87077e03cc fix kqueue feature detection on Mac OS X 10.6 2009-12-18 15:14:33 +01:00
Ryan Dahl
20b945df70 Upgrade V8 to 2.0.5 2009-12-18 15:05:04 +01:00
Ryan McGrath
164ce76e94 Added in API documentation concerning the (seemingly undocumented) process.chdir() method, complementary to process.cwd() 2009-12-18 14:59:33 +01:00
Ryan Dahl
89a3fa93a0 add missing semicolon 2009-12-09 15:59:53 +01:00
Simon Cornelius P. Umacob
e801f420d0 Use conf.fatal() instead of fatal() in order to abort the configure script 2009-12-09 14:28:02 +01:00
Ryan Dahl
a73227bf28 Upgrade waf to 1.5.10 2009-12-09 14:27:33 +01:00
Ryan Dahl
4ddfd8aa42 Fix posix.statSync() 2009-12-09 10:32:19 +01:00
Ryan Dahl
45a806a066 Statically define symbols
~7% improvement in hello world HTTP response bench.
2009-12-09 09:12:01 +01:00
Ryan Dahl
a30ac92b0c Remove accidentally committed files. 2009-12-09 07:44:44 +01:00
Ryan Dahl
89df4d1c86 fix typo 2009-12-08 07:20:51 +01:00
Ryan Dahl
dbb1a267d7 Fix ARGV[0] weirdness 2009-12-08 06:54:26 +01:00
Johan Dahlberg
9599d2d0e9 Added superCtor to ctor.super_ instead superCtor.prototype.
This way let's us do deep comparison between object instances.

I have a suggestion for the sys.inherits function. Today it's impossible to
deep comparison between instance and class.

Take this snippet for example:

function ClassA() {}
function ClassB() {}

sys.inherits(ClassB, ClassA);

var instance = new ClassB();

The instance variable inherits from ClassA but we can't check it (which is
useful sometimes). You can compare the instance against ClassB
(instance.constructor == ClassB) but we can't compare it deeper
(instance.constructor.super == ClassA). The committed change simply assign
super to the super constructor instead of the super prototype.

I can't see any problem with this fix. You can still get the super constructor
by calling super_.prototype.
2009-12-08 06:19:12 +01:00
visionmedia
501b4a54be Export STATUS_CODES
Express (my framework) uses them as a default
response body when non is present. Others
might use them for something as well.

Beats duplicating the list :D
2009-12-08 05:35:56 +01:00
Ryan Dahl
71680f512c Give default encodings for posix.read and posix.write 2009-12-07 18:13:45 +01:00
Ryan Dahl
c1baa70fe5 Attach/Detach -> Ref/Unref 2009-12-07 17:55:19 +01:00
Ryan Dahl
ee8530e0ee offload method look up to http-parser 2009-12-07 15:21:12 +01:00
Xavier Shay
756544fd28 sys.inspect prints out special chars correctly (\n, \u0001, etc...) 2009-12-07 10:05:18 +01:00
Ryan Dahl
c3e0a4bc7c Upgrade http-parser; supports webdav extension methods now 2009-12-06 23:58:16 +01:00
Felix Geisendörfer
876b6d2183 Make process.mixin copy over undefined values
This is not a bug in process.mixin, but I think it is undesirable
behavior. Right now process.mixin will not copy over keys with undefined
values. To me that is an unexpected filtering that should not happen
unless specifically called for.
2009-12-06 19:21:20 +01:00
Felix Geisendörfer
f080de5380 Two bug fixes for process.mixin
Bug #1 occurred when trying to use process.mixin on a function and
produced a fatal exception.

Bug #2 occurred when trying to do a deep merge with an object containing
one or more objects with a nodeType property. In those cases the deep
copy for this part of the object was not performed and a shallow one was
performed instead.

Both of these bugs were artifacts of the jQuery.extend port.
2009-12-06 19:21:06 +01:00
Christopher Lenz
f8ba9c3bc9 Add http.Client.prototype.request()
Change the http.Client API so that it provides a single request() method
taking an optional parameter to specify the HTTP method (defaulting to
"GET"), instead of the five methods get(), head(), post(), del() and put().
2009-12-06 18:36:32 +01:00
Ryan Dahl
c6affb64f9 bump version 2009-12-06 17:59:37 +01:00
Xavier Shay
34c02357ff sys.inspect is totally more awesome now
- No longer relies on JSON.stringify, so it can output nulls and functions
- Handles circular references better
- Has tests
2009-12-06 12:19:23 +01:00
Ryan Dahl
4d818f1fd3 Implement promises entirely in JS 2009-12-06 11:36:22 +01:00
Ryan Dahl
3414eab2f3 Refactor node_file.cc to not use Promises.
At the same time implement synchronous wrappers of the POSIX functions.
These will be undocumented until we settle on an API. Works like this

    // returns promise as before
    posix.mkdir("test").addCallback(function () {
      sys.puts("done");
    });

    // returns undefined, executed synchronously.
    posix.mkdirSync("test");
    sys.puts("done");

This refactoring is a step towards allowing promises to be implemented
purely in javascript.
2009-12-06 10:50:03 +01:00
Ryan Dahl
8141448fe5 Don't use promises internally in DNS module 2009-12-06 09:26:09 +01:00
Ryan Dahl
90ab0794df Use --jobs=1 with WAF
Some people were reporting waf erroring with

  thread.error: can't start new thread

this seems to fix that problem.
2009-12-06 07:35:26 +01:00
Ryan Dahl
48452838b3 Clean up context creation 2009-12-05 18:27:28 +01:00
Ryan Dahl
c8b6ef248e upgrade v8 to 2.0.3 2009-12-05 15:27:56 +01:00
Ryan Dahl
c5d82380f4 Bugfix: Don't use chunked encoding for 1.0 requests.
http://groups.google.com/group/nodejs/browse_thread/thread/b2edb76691b1848c
2009-12-05 08:37:46 +01:00
Ryan Dahl
7538e70767 Expose versionMajor versionMinor to http messages 2009-12-05 07:55:24 +01:00
Karl Guertin
4f679fd8d0 Dependency free assert module with unit tests 2009-12-05 01:05:16 +01:00
Felix Geisendörfer
530328f12b CommonJS testing for node.js
Refactored test suite to use the assert module for testing rather than
mjsunit.
2009-12-05 01:05:16 +01:00
Michaeljohn Clement
485823f3e4 fixed HTTP duplicated header bug
added test case for HTTP duplicated header bug on keepalive
2009-12-05 00:56:22 +01:00
Rhys Jones
5b1a535cd8 Add HTTP client TLS support 2009-11-30 16:51:20 +01:00
jed
a9ea21feb4 fixed check on header type, to check member instead of object. 2009-11-30 10:14:09 +01:00
Friedemann Altrock
1107a1bd1e sys.puts should not kill the process when giving it undefined 2009-11-28 20:56:47 +01:00
Ryan Dahl
aa42c6790d bump version 2009-11-28 17:04:42 +01:00
Ryan Dahl
38e425d9bf Add V8 heap info to process.memoryUsage() 2009-11-28 16:31:29 +01:00
Ryan Dahl
8a58e83870 Add gnutls version to configure script 2009-11-28 15:25:10 +01:00
choonkeat
44d5f212fe Stat::Callback has 2 arguments for callback: current stat info and previous stat info
http://groups.google.com/group/nodejs/msg/f8e51a8e0c74bd85
2009-11-28 15:13:12 +01:00
Ryan Dahl
633d6be328 bump version 2009-11-28 01:49:11 +01:00
Ryan Dahl
0cea946cb9 Fix v8 SConstruct for freebsd 2009-11-28 01:38:32 +01:00
simonw
516874f4a1 Documented repl.scope for explicitly exposing variables within the repl. 2009-11-27 23:02:13 +01:00
Ryan Dahl
4129305b7c Upgrade v8 to 2.0.2 2009-11-27 22:53:39 +01:00
Ryan Dahl
dc093ef833 Add process.loop() process.unloop()!!!
Move the event loop calls into javascript.
Makes life so much easier.
2009-11-23 00:59:39 +01:00
Jan Lehnardt
9c1034b183 detect ccache and bail out since v8 doens't like to build with ccache 2009-11-22 23:42:02 +01:00
Friedemann Altrock
0433d828cf add process.umask() 2009-11-22 19:52:52 +01:00
Friedemann Altrock
2d54d664ff Promises should not be able to be canceled more than once. 2009-11-22 19:18:24 +01:00
Felix Geisendörfer
27fcae738a Reduce multipart memory footprint
Multipart parts kept the first chunk of data after their headers in
memory, even so that was no longer needed.
2009-11-22 15:09:55 +01:00
Rhys Jones
b6dda61249 Initial TLS support 2009-11-22 04:03:53 +01:00
Ryan Dahl
1cacb50f2b Fix memory leak on fs.write()
Reported by onne@onnlucky.com.
2009-11-22 00:47:36 +01:00
Ryan Dahl
8be6a89654 Upgrade http_parser (fixes bug reported by Felix) 2009-11-21 22:03:52 +01:00
Felix Geisendörfer
528c449901 Multipart improvements
Multipart parts now have a name and filename property. Those are the
same as:

part.headers['content-disposition'].name
part.headers['content-disposition'].filename

This patch also updates and improves the docs for the multipart module.
2009-11-21 17:16:06 +01:00
Ryan Dahl
39a12b2a22 Remove debug message 2009-11-21 17:16:05 +01:00
Ryan Dahl
7719ce33db New http-parser
No longer based on Ragel, but hand-written.

Had to add HTTPConnection.resetParser() because the parser is stricter and
will error out when you try to give it a message after the previous had
"Connection: close". The HTTP client was doing that. Thus we reset the
parser manually after each new connection.
2009-11-21 16:27:02 +01:00
Ryan Dahl
1eba0cadc1 Revert "Normalize HTTP headers."
This reverts commit f623fd7658.
But only the changes made in lib/ they were falsely detecting outgoing
headers.
2009-11-21 15:52:12 +01:00
Onne
9d39e18c6d fixes lib/file.js write, it doesnt allways emit errors or success 2009-11-19 19:12:42 +01:00
Ryan Dahl
686bec4f35 Only detach timers when active. 2009-11-19 19:08:47 +01:00
Ryan Dahl
0b441462ab Speed up test-wait-ordering.js 2009-11-18 15:55:02 +01:00
Ryan Dahl
728d8a37f4 Upgrade v8 to 2.0
(With just one change: remove -Werror)
2009-11-18 15:28:54 +01:00
Ryan Dahl
8195e0f723 Fix default value for persistent in watchFile() 2009-11-17 23:07:31 +01:00
Ryan Dahl
6de2173d7c Add options to process.watchFile() 2009-11-17 22:35:47 +01:00
Ryan Dahl
027829d285 bump version 2009-11-17 15:05:10 +01:00
Ryan Dahl
6cb0e0e5f5 Test runner should only run test-*.js 2009-11-17 15:05:10 +01:00
Ryan Dahl
6e6562e551 Fix stat handler test for macintosh 2009-11-17 15:05:01 +01:00
Ryan Dahl
0bf34b598f add link to slides on web page 2009-11-17 14:22:23 +01:00
Ryan Dahl
8d2f9e83a4 Add process.watchFile() process.unwatchFile()
This is an interface to libev's ev_stat watcher.
2009-11-17 14:07:48 +01:00
Ryan Dahl
55f9fdd6b5 Upgrade libev to latest CVS 2009-11-17 12:41:19 +01:00
Felix Geisendörfer
6e9e61b9df Format JSON for inspecting objects
This patch enables formatting for inspecting JSON objects. Example:

p({foo: "bar", deep: {foo: "bar"}})

becomes:

{
 "foo": "bar",
 "deep": {
  "foo": "bar"
 }
}
2009-11-16 12:40:58 +01:00
Ryan Dahl
ca2c7d1745 Add doc for uncaughtException 2009-11-15 01:06:13 +01:00
Felix Geisendörfer
2b252acea4 Implement process "uncaughtException" event
This event can be used to overwrite the default exception mechanism which
reports the exception and kills the node process.

See google group post:
http://groups.google.com/group/nodejs/browse_thread/thread/9721dc3a2638446f
2009-11-14 23:46:37 +01:00
fwg
bd6c08a984 Add EventEmitter.removeListener 2009-11-13 17:12:41 +01:00
Johan Sørensen
04f9c9fb09 Supply the strerror as a second arg to the tcp.Connection close event 2009-11-13 15:17:23 +01:00
Ryan Dahl
06d493e7e3 Remove debug message 2009-11-12 12:47:02 +01:00
Felix Geisendörfer
bb8f0725da Bugfix, Promise.timeout() blocked the event loop
Promise.timeout() was blocking the event loop from shutting down while it
was waiting for an internal timer to fire. This timer is now cleared when
it is no longer needed, causing the event loop to shut down as fast as
possible.
2009-11-12 12:45:06 +01:00
Felix Geisendörfer
bffee5eda4 Bugfix for sendBody() and chunked utf8 strings
Http expects chunked byte offsets and ignores the encoding specified in the
header. This patch makes node behave accordingly.

Bug report:
http://groups.google.com/group/nodejs/browse_thread/thread/ab701d49cb059317
2009-11-11 18:53:05 +01:00
Felix Geisendörfer
7371fcb312 Temporary function to determine str byte length
Will need a better place later on
2009-11-11 18:42:46 +01:00
Felix Geisendörfer
1026ffea40 Proper deprecation message for process.inherits 2009-11-11 17:38:45 +01:00
Ryan Dahl
2ca788e6e2 Add 'drain' event to tcp.Connection 2009-11-10 17:43:37 +01:00
Ryan Dahl
d1f69ef35d bump version 2009-11-07 20:20:30 +01:00
Felix Geisendörfer
a021db151a Bug fix for test-remote-module-loading.js
Fix bug that caused test-remote-module-loading.js
to use the installed version of the http library
rather than the build one.
2009-11-07 20:07:55 +01:00
Ryan Dahl
6c9ec1ac40 Use '127.0.0.1' instead of 'localhost' for keep-alive test
ab seems to have to problem resolving 'localhost' on Urban's computer.
2009-11-07 17:31:42 +01:00
Ryan Dahl
cff1df1f9b Fix ev_unref error in signal handler 2009-11-07 17:18:23 +01:00
Ryan Dahl
42dd629c16 deprecation error for process.inherits() 2009-11-07 16:27:18 +01:00
Ryan Dahl
9cfa4fd7d6 Output stderr from test-remote-module-loading.js
There is a small problem with test-remote-module-loading.js.
When it starts a child "node", the child uses the default require.paths
instead unshifting the build lib/
2009-11-07 15:08:46 +01:00
Ryan Dahl
1020efb6f7 Create require.main, remove process.cat() 2009-11-07 14:57:49 +01:00
Ryan Dahl
43121c15be API: rename process.inherits to sys.inherits 2009-11-07 14:45:39 +01:00
Ryan Dahl
d737a060c8 Combine all compiled javascript files into src/node.js 2009-11-07 14:37:22 +01:00
Ryan Dahl
b833aa48e9 Add test to ensure the server can handle keep-alive 2009-11-06 13:42:56 +01:00
Ryan Dahl
54c8ea5ea2 Fix http_simple server for new API 2009-11-06 12:53:27 +01:00
Ryan Dahl
51c1526b6a Revert "Upgrade http parser, change node as needed."
Something is broken in how keep-alive is working. Reverting until I can fix
it.

This reverts commit b893859c34.
2009-11-06 12:44:20 +01:00
Ryan Dahl
8ad47c8de7 Expose http.IncomingMessage and http.OutgoingMessage 2009-11-05 00:02:15 +01:00
Ryan Dahl
c6bd0e56cb Fix regexp in file extension checking 2009-11-04 12:39:08 +01:00
Ryan Dahl
60131fc88c Expose http.ClientRequest and http.ServerResponse 2009-11-04 12:37:52 +01:00
Ryan Dahl
711774c1f0 Remove unreachable lines 2009-11-04 02:18:31 +01:00
Ryan Dahl
d3de943eb1 Fix google-analytics on index.html 2009-11-04 00:18:05 +01:00
Brandon Beacher
47fcf785ac Added process.chdir() 2009-11-03 19:22:37 +01:00
Ryan Dahl
726865af7b bump version 2009-11-03 13:48:02 +01:00
Ryan Dahl
b3b3cfe007 Move memoryUsage() into C on Linux 2009-11-03 13:00:42 +01:00
Ryan Dahl
3a70129a9c Add sys.memoryUsage() 2009-11-03 01:30:01 +01:00
Ryan Dahl
f481183140 Add process.platform 2009-11-03 00:21:00 +01:00
Ryan Dahl
f97d339ce7 Add requires to google example in docs. 2009-11-02 23:09:57 +01:00
Felix Geisendörfer
43d651daef The return of relative module loading 2009-11-02 21:26:55 +01:00
Felix Geisendörfer
7069bee982 The return of absolute Module loading 2009-11-02 21:20:44 +01:00
Ryan Dahl
2e40a9e15f Add mediacoder's logo to website 2009-11-02 12:28:08 +01:00
Felix Geisendörfer
8fd472b9a1 The return of remote module loading 2009-11-01 15:39:49 +01:00
Ryan Dahl
9bd2717e74 require.paths aliased as process.path 2009-11-01 09:30:01 +01:00
Ryan Dahl
cf652b82a3 Update webpage with new module api 2009-10-31 20:26:03 +01:00
Ryan Dahl
d582599c14 Upgrade benchmark scripts for new module API 2009-10-31 20:06:46 +01:00
Ryan Dahl
f230e45183 Update deprecation errors. 2009-10-31 20:03:40 +01:00
Ryan Dahl
9a7321ebb0 Don't call process.exit() on missing module.
Just raise exception naturally.
2009-10-31 19:53:09 +01:00
Ryan Dahl
f683867b98 module.name renamed to module.id for commonjs compat 2009-10-31 19:47:41 +01:00
Ryan Dahl
f5c95c388c Fix search-replace errors in api.txt 2009-10-31 19:14:24 +01:00
Ryan Dahl
7a2e784ad7 Module refactor - almost CommonJS compatible now
API change summary:

  * require("/sys.js") becomes require("sys")

  * require("circle.js") becomes require("./circle")

  * process.path.join() becomes require("path").join()
2009-10-31 19:10:30 +01:00
Ryan Dahl
36f3bc33a3 forgot to add lib/dns.js in c53672 2009-10-31 12:19:23 +01:00
Ryan Dahl
57890465bd A few more node->process changes 2009-10-30 05:49:23 +01:00
Ryan Dahl
ad0a4cefb8 Namespace EVERYTHING under process; introduce GLOBAL
http://groups.google.com/group/nodejs/browse_thread/thread/1034fd2ad2cd93e8
2009-10-29 23:36:41 +01:00
Ryan Dahl
6959a1d6d1 Upgrade v8 to 1.3.18 2009-10-29 16:11:05 +01:00
Felix Geisendörfer
659954d842 The return of Promise.cancel() with some additional tests & docs 2009-10-29 11:24:08 +01:00
Ryan Dahl
7b2fdc098b Clean up posix module docs 2009-10-29 11:17:26 +01:00
Ryan Dahl
c536728335 Move node.dns.* into /dns.js 2009-10-28 23:02:52 +01:00
Ryan Dahl
3d8b14e6f7 node.fs.* moved into "/posix.js"
use require("/posix.js") to access them.
2009-10-28 22:45:46 +01:00
Ryan Dahl
ae7c9909be fix error from v8 upgrade 2009-10-28 21:35:49 +01:00
Ryan Dahl
50f45d14b4 Upgrade v8 to 1.3.17 2009-10-28 19:25:22 +01:00
Tim Caswell
3558952899 DRY up the open, write, read, and close methods on the File prototype. 2009-10-28 19:17:02 +01:00
Ryan Dahl
eca2de73ed bump version 2009-10-28 16:36:44 +01:00
Ryan Dahl
910c627fc6 Revert "Change HTTP back to a 1.1 client."
This reverts commit 9a70abbf13.
2009-10-28 15:37:58 +01:00
Ryan Dahl
efe34f5023 Only allow a promise to fire once, remove promise.cancel()
promise.cancel() is due to return at some point.
2009-10-28 15:37:03 +01:00
Ryan Dahl
fc937aa3e5 Use full path to link to libv8.a and libudns.a
Previously was linking just by doing -lv8 or -ludns which could confuse the
build when a system libv8 or libudns was installed.
2009-10-28 12:34:47 +01:00
Ryan Dahl
122e74b49b Link to objects instead of shlibs for evcom, http_parser, coupling 2009-10-27 22:26:53 +01:00
Ryan Dahl
5f466c8762 fix make install (was broken from node_ prefix change) 2009-10-27 20:17:03 +01:00
Ryan Dahl
c779647600 Link libev and libeio as a normal .o instead of as .a
Using WAF "staticlib" to compile libev tends to confuse it with a system
version. Thanks to mr.binary42 for helping debug.
2009-10-27 18:50:41 +01:00
Ryan Dahl
132d685796 Add symlinks in root directory to executables after build. 2009-10-27 18:11:07 +01:00
Ryan Dahl
2b743aa5bb Enable large file support. 2009-10-27 12:05:38 +01:00
Ryan Dahl
a5df0f6a65 Prefix all source files with node_ 2009-10-27 11:46:58 +01:00
Ryan Dahl
2bac299aed Remove unused macro 2009-10-27 11:08:50 +01:00
Ryan Dahl
9a70abbf13 Change HTTP back to a 1.1 client.
This was modified in b893859c34 even though it
wasn't really required. Some users are experiencing problems after changing
to 1.0 - once those are identified the client will returned to 1.0.
2009-10-26 23:07:37 +01:00
Ryan Dahl
7d9d881e22 Correctly guess x64 architecture
Previously was dependent on how python was compiled, and this was causing
build errors for some Macintosh Snow Leopard users. The solution is to use
a functionality already in WAF which looks at the output of

  echo | gcc -E -dM -
2009-10-26 22:27:52 +01:00
Ryan Dahl
04e53cab90 Rename node.libraryPaths to require.paths
to be more inline with CommonJS.
2009-10-25 22:51:57 +01:00
Ryan Dahl
4bcb01c8bf Add work-around for configure --debug with Python 2.4.3
This is the error that was encountered:

  : make
  Waf: Entering directory `/dcs/06/csugds/node/ry-node-cfe5876/build'
  Traceback (most recent call last):
    File "tools/waf-light", line 148, in ?
      Scripting.prepare(t, cwd, VERSION, wafdir)
    File "/dcs/06/csugds/node/ry-node-cfe5876/tools/wafadmin/Scripting.py", line 142, in prepare
      prepare_impl(t, cwd, ver, wafdir)
    File "/dcs/06/csugds/node/ry-node-cfe5876/tools/wafadmin/Scripting.py", line 132, in prepare_impl
      main()
    File "/dcs/06/csugds/node/ry-node-cfe5876/tools/wafadmin/Scripting.py", line 185, in main
      fun(ctx)
    File "/dcs/06/csugds/node/ry-node-cfe5876/tools/wafadmin/Scripting.py", line 382, in build
      return build_impl(bld)
    File "/dcs/06/csugds/node/ry-node-cfe5876/tools/wafadmin/Scripting.py", line 395, in build_impl
      bld.add_subdirs([os.path.split(Utils.g_module.root_path)[0]])
    File "/dcs/06/csugds/node/ry-node-cfe5876/tools/wafadmin/Build.py", line 924, in add_subdirs
      self.recurse(dirs, 'build')
    File "/dcs/06/csugds/node/ry-node-cfe5876/tools/wafadmin/Utils.py", line 599, in recurse
      f(self)
    File "<string>", line 312, in build
    File "/dcs/06/csugds/node/ry-node-cfe5876/tools/wafadmin/TaskGen.py", line 297, in clone
      setattr(newobj, x, copy.copy(getattr(self, x)))
    File "/usr/lib/python2.4/copy.py", line 108, in copy
      return _reconstruct(x, rv, 0)
    File "/usr/lib/python2.4/copy.py", line 336, in _reconstruct
      y = callable(*args)
    File "/usr/lib/python2.4/copy_reg.py", line 92, in __newobj__
      return cls.__new__(cls, *args)
  TypeError: function() takes at least 2 arguments (0 given)
  make: *** [all] Error 1
2009-10-16 22:53:44 +02:00
Ryan Dahl
cfe5876350 Add v8 patch to fix mac x64 build.
http://codereview.chromium.org/284012
2009-10-16 18:00:06 +02:00
Ryan Dahl
8e6d978bba Upgrade v8 to 1.3.16
and apply my V8 patch for debugging.
2009-10-16 14:30:27 +02:00
Ryan Dahl
5f82c4baf0 Improve webpage
- add google-analytics
- add example to front-page
2009-10-16 14:29:51 +02:00
Ryan Dahl
b893859c34 Upgrade http parser, change node as needed.
The latest version of http-parser is a bit more stringent EOF semantics.
2009-10-15 19:18:18 +02:00
Ryan Dahl
3456a16f71 Accept string representations of signals in node.kill and child.kill 2009-10-15 15:45:04 +02:00
Brandon Beacher
334d56d2be Added external interface for signal handlers.
Also process.pid and node.kill().
2009-10-15 14:40:52 +02:00
Ryan Dahl
0283e68129 Upgrade http_parser, allows quotes in URI
http_parser needs to be upgraded to latest code. Currently running off the
v0.2 branch, which is missing the latest fixes.
2009-10-14 19:29:17 +02:00
Connor Dunn
2dbd0d3806 Add node.fs.sendfile() 2009-10-14 18:51:23 +02:00
Ryan Dahl
a1e5089d9b Add connection.fd getter. 2009-10-14 17:07:50 +02:00
Tim Caswell
d2f5094096 Fix the link to the new Contribute section 2009-10-14 14:21:30 +02:00
Felix Geisendörfer
fd189c8a73 New section about contributing for the homepage 2009-10-13 19:55:34 +02:00
Timothy Caswell
2b9a9f9140 Clean up many of the reccommendations from jslint in the file.js library 2009-10-13 19:55:33 +02:00
Timothy Caswell
8bf9a42c70 Cleanup node.fs.cat to follow the newer style to match the code of file.writeFile 2009-10-13 19:55:33 +02:00
Ryan Dahl
2b8ab7e24f utils.js links to sys.js instead of other way around 2009-10-13 19:55:28 +02:00
Felix Geisendörfer
0329468e73 Fix for confusing deprecation message 2009-10-12 22:23:17 +02:00
Ryan Dahl
12c2ea05ca Bugfix: 'data' event for stdio should emit a string
Was emitting a single element array where array[0] was the input.
2009-10-12 21:09:26 +02:00
Felix Geisendörfer
f09d0cd93c Documentation for Promise.timeout() and Promise.cancel() 2009-10-12 17:07:17 +02:00
Ryan Dahl
d949074014 Add some code comments to net.cc 2009-10-12 16:46:18 +02:00
Felix Geisendörfer
0dbf2d7792 Implemented Promise.timeout() and Promise.cancel() 2009-10-12 16:17:42 +02:00
Ryan Dahl
e7d0dcee10 Use bundle flags for osx in node-waf 2009-10-12 16:01:22 +02:00
Ryan Dahl
8b62e8616b Fix tabs in changelog 2009-10-10 11:58:36 +02:00
Ryan Dahl
d79b6e9f7f bump version 2009-10-09 18:15:16 +02:00
Ryan Dahl
e7096fd769 ACTUALLY remove node_version.h from node.h 2009-10-09 17:49:29 +02:00
Ryan Dahl
0ae02c9f04 Internalize node_version.h.
With the more detailed node.version changing (every commit), having
node_version.h exposed to all modules required a complete recompile each
time a commit was made.

People can use the javascript interface to get the version.
2009-10-09 17:47:04 +02:00
Ryan Dahl
388145546d Add comments to node.cc 2009-10-09 17:44:59 +02:00
Ryan Dahl
962e9291f7 'git-describe' to 'git describe' 2009-10-09 16:16:27 +02:00
Ryan Dahl
d979ac9c7f Put git revision into version string 2009-10-09 15:00:12 +02:00
Ryan Dahl
78d06eec06 Clean up README. 2009-10-09 14:55:29 +02:00
Ryan Dahl
2060e32ec9 Kill -Werror in V8 for GCC 4.4.1 users.
http://code.google.com/p/v8/issues/detail?id=413
2009-10-09 14:21:41 +02:00
Ryan Dahl
335d9af71f Update docs to use sys.js and not so much mixin(). 2009-10-09 14:18:10 +02:00
Ryan Dahl
349200bd1c symlink sys.js to utils.js 2009-10-09 14:09:42 +02:00
Ryan Dahl
6325878d43 Raise helpful error when include() is called. 2009-10-09 13:30:27 +02:00
Ryan Dahl
e742d077e0 Enable debugging.
Use the --debug command line flag to enable.

It appears that d8 sucks. Luckily it can be rewritten rather easily with the
repl and tcp client libraries.

Node's CL option parsing is getting rather unwieldy - needs refactor.
2009-10-09 13:26:23 +02:00
Ryan Dahl
59b7a1bf26 More updates to wscripts v8 building.
This allows me to hack on V8 without recompiling the whole thing.
2009-10-09 12:59:42 +02:00
Ryan Dahl
d85724d741 Fix wscript for python 2.4 2009-10-09 00:34:39 +02:00
Ryan Dahl
53ebe75930 Improve build for V8
Users following HEAD should 'make distclean' and reconfigure after this
update.
2009-10-08 23:20:14 +02:00
Ryan Dahl
e46a832ded Use /bin/sh from exec() 2009-10-08 01:30:26 +02:00
Felix Geisendörfer
6219f2a2be Removed getHeader() function thanks to f623f 2009-10-07 17:30:30 +02:00
Ryan Dahl
f623fd7658 Normalize HTTP headers.
"Content-Length" becomes "content-length".
2009-10-07 16:56:19 +02:00
Ryan Dahl
d03b67669c Upgrade v8 to 1.3.15 2009-10-07 16:02:34 +02:00
Ryan Dahl
b404996cf3 Fix --v8-options command line argument. 2009-10-07 16:01:03 +02:00
Ryan Dahl
b76d853f0d Fix test-signal-handler.js on macintosh - pause before exit. 2009-10-07 15:39:39 +02:00
Ryan Dahl
be2ca1ec80 Fix build.
- Add -f flag to rm on make clean.
- Use old jsmin - the new one seems to be broken.
2009-10-07 15:02:42 +02:00
Ryan Dahl
e982349b16 Fix 'make distclean' 2009-10-07 12:43:21 +02:00
Ryan Dahl
1f31a7dbfe Upgrade v8 to 1.3.14 2009-10-07 11:53:45 +02:00
Ryan Dahl
1a2762b78e Update benchmarks with new createChildProcess API 2009-10-07 10:24:50 +02:00
Felix Geisendörfer
abbc624f52 Multipart test now uses a fixture instead of CURL 2009-10-07 02:03:24 +02:00
Felix Geisendörfer
3fd1cba073 Fixed bad indention in multipart.js 2009-10-07 02:03:24 +02:00
Ryan Dahl
1817d4b062 ev_unref() the signal handlers.
That means even if they are Attached(), libev will still exit if there is
nothing else to do.
2009-10-07 01:35:21 +02:00
Brandon Beacher
f068251494 Added signal handler.
To be used internally. Needs an exposed interface.
2009-10-07 01:23:29 +02:00
Ryan Dahl
82465fc4b1 Do not use /bin/sh to create child processes.
Instead directly call execvp(). This change is needed for the
soon-to-be-added signal handlers because the /bin/sh parent process does not
pass all signals to it's children, particularly SIGUSR1 on Linux.

The parameters of createChildProcess had to be changed slightly.
utils.exec() also has a changed implementation. A bug involving quoted
arguments was knowingly introduced into utils.exec(). Will fix later.
2009-10-07 01:08:33 +02:00
Ryan Dahl
39c61367a7 Only arguments before -- should be passed to V8. 2009-10-06 16:28:52 +02:00
Ryan Dahl
2b994d9e37 Also accept 'utf-8' to specify utf8 encodings. 2009-10-06 10:45:18 +02:00
Ryan Dahl
ae6a172308 Simplify 'make distclean' by just doing 'rm -rf build' 2009-10-06 00:44:08 +02:00
Ryan Dahl
d67288b643 Add __module to reference current node.Module object. 2009-10-05 21:01:30 +02:00
Ryan Dahl
78f8b6771c Add require.async(). 2009-10-05 20:35:48 +02:00
Ryan Dahl
d703813c27 Remove target argument from node.Module#newChild. 2009-10-05 20:35:05 +02:00
Ryan Dahl
a0c464638c Remove old references to node.loadingModules 2009-10-05 20:29:59 +02:00
Ryan Dahl
3e9dd0e2e3 Remove include() from website. 2009-10-05 19:15:38 +02:00
Ryan Dahl
8185e1fd25 Remove include() add node.mixin()
include() should not be used by libraries because it will pollute the global
namespace. To discourage this behavior and bring Node more in-line with
the current CommonJS module system, include() is removed.

Small scripts like unit tests often times do want to pollute the global
namespace for ease. To avoid the boiler plate code of

  var x = require("/x.js");
  var foo = x.foo;
  var bar = x.bar;

The function node.mixin() is stolen from jQuery's jQuery.extend. So that it
can be written:

  node.mixin(require("/x.js"));

Reference:
http://docs.jquery.com/Utilities/jQuery.extend
http://groups.google.com/group/nodejs/browse_thread/thread/f9ac83e5c11e7e87
2009-10-05 15:46:31 +02:00
Ryan Dahl
522909bcbf Parse queryString into req.uri.params 2009-10-05 14:52:26 +02:00
Ryan Dahl
4c51af882d Fix typo 2009-10-05 13:16:56 +02:00
Ryan Dahl
bac16bd8ac Remove node.pc 2009-10-05 13:04:21 +02:00
Ryan Dahl
e2b7902469 Don't use parseUri for HTTP server
The big parseUri RE was showing up often in profiles - this is simpler and
yields better performance by taking advantage of the C http parser.
2009-10-04 12:19:01 +02:00
Ryan Dahl
7b8842b619 Modify node_addon configure api 2009-10-04 11:50:53 +02:00
Ryan Dahl
5c9fe1fce1 Update addon documentation 2009-10-04 11:14:39 +02:00
Ryan Dahl
39e6d959d7 Add node-waf to help with building addons. 2009-10-04 10:33:39 +02:00
Ryan Dahl
13793aed20 Add Makefiles which were forgotten. 2009-10-03 22:48:44 +02:00
Ryan Dahl
bf0d278a45 Improve "make dist" remove generated doc from repo. 2009-10-03 22:48:33 +02:00
Ryan Dahl
861f28f37a Don't unnecessarily output the makefile from the configure script. 2009-10-03 21:46:59 +02:00
Ryan Dahl
6f17ca51c3 Install wafadmin into $PREFIX/lib/node/wafadmin
This is in preparation for a special node_waf script for building external
modules.

Also change system library path to $PREFIX/lib/node/libraries
2009-10-03 19:09:00 +02:00
Felix Geisendörfer
eeaa267cbe Documentation for Multipart parser
Also added multipart.parse as a convenience function
2009-10-03 18:06:24 +02:00
Ryan Dahl
602f9dbf3f SetClassName on internal classes. 2009-10-03 15:08:03 +02:00
Ryan Dahl
b66c5c9808 Replace DEFINE_SIMPLE_CALLBACK macros with explicit functions 2009-10-03 14:45:35 +02:00
Ryan Dahl
84d2966377 Use waf-light instead of waf
This way there won't be strange tools/.waf-12343 directories hanging about.
All that waf needs to run is inside the tools/wafadmin directory.
2009-10-02 17:05:42 +02:00
Ryan Dahl
763137e705 chat.tinyclouds.org -> chat.nodejs.org 2009-10-02 16:24:49 +02:00
Ryan Dahl
bc9b343fd3 Add note about symbol visibility in V8 to wscript 2009-10-02 14:10:40 +02:00
Ryan Dahl
9c9d67eb6c bump version 2009-09-30 23:21:25 +02:00
Ryan Dahl
7b337096c9 Add a third argument to http.cat to specify req headers. 2009-09-30 11:55:03 +02:00
isaacs
45f5402446 Pass the Host header in http.cat calls, if it was specified in the URL passed to http.cat. 2009-09-29 16:38:07 -07:00
Ryan Dahl
a8c0211e73 Bugfix: require() and include() should work in callbacks.
Removing requireAsync and includeAsync from global scope for now as a
temporary fix.  Reported by Yuffster.
2009-09-29 19:28:54 +02:00
Ryan Dahl
1ae69a68a4 Clean up some text in documentation. 2009-09-29 18:06:36 +02:00
Ryan Dahl
cda659a8c8 Camel-case all http events 2009-09-29 18:06:14 +02:00
Ryan Dahl
18da8ffaee Copy Python's shutil.copytree into wscript.
It's broken in Python 2.4.4. One gets this message when trying to run
configure:

  [...]
  Checking for SYS_clock_gettime           : ok
  Checking for library rt                  : ok
  Checking for function clock_gettime      : ok
  Checking for function nanosleep          : ok
  Checking for function ceil               : ok
  ---- deps/udns ----
  Traceback (most recent call last):
    File "/path/to/node/tools/waf", line 148, in ?
      Scripting.prepare(t, cwd, VERSION, wafdir)
    File "/path/to/node/tools/.waf-1.5.8-3e327cd9534c48e6762f56fdb1332663/wafadmin/Scripting.py", line 102, in prepare
      prepare_impl(t,cwd,ver,wafdir)
    File "/path/to/node/tools/.waf-1.5.8-3e327cd9534c48e6762f56fdb1332663/wafadmin/Scripting.py", line 95, in prepare_impl
      main()
    File "/path/to/node/tools/.waf-1.5.8-3e327cd9534c48e6762f56fdb1332663/wafadmin/Scripting.py", line 130, in main
      fun(ctx)
    File "/path/to/node/tools/.waf-1.5.8-3e327cd9534c48e6762f56fdb1332663/wafadmin/Scripting.py", line 168, in configure
      conf.sub_config([''])
    File "/path/to/node/tools/.waf-1.5.8-3e327cd9534c48e6762f56fdb1332663/wafadmin/Configure.py", line 100, in sub_config
      self.recurse(k,name='configure')
    File "/path/to/node/tools/.waf-1.5.8-3e327cd9534c48e6762f56fdb1332663/wafadmin/Utils.py", line 391, in recurse
      f(self)
    File "<string>", line 82, in configure
    File "<string>", line 48, in conf_subproject
    File "/usr/lib/python2.4/shutil.py", line 111, in copytree
      os.mkdir(dst)
  OSError: [Errno 2] No such file or directory: '/sites/rabidlabs.net/sandboxes/m/public_html/projects/0909.node/node/build/default/deps/udns'

The problem is probably this:
http://mail.python.org/pipermail/python-bugs-list/2005-January/027118.html

As a solution I am copying 2.6's version of the function in.
2009-09-28 22:39:00 +02:00
Ryan Dahl
4ba5b7e24b Add doc for node.compile() 2009-09-28 22:16:43 +02:00
Ryan Dahl
e972add0ea Update module loading docs 2009-09-28 19:44:40 +02:00
Ryan Dahl
b7526eb324 Add warning when coroutine stack size grows too large.
For the moment too large is 10.
2009-09-28 18:48:19 +02:00
Ryan Dahl
9f07a690c6 docs: Reference node.libraryPaths in helpers section. 2009-09-28 18:48:19 +02:00
Ryan Dahl
27738d8e60 Clean up some things in the repl, add docs. 2009-09-28 18:48:19 +02:00
Ryan Dahl
835554c92b Error message on bad module load. 2009-09-28 18:48:19 +02:00
Ryan Dahl
23c7f472d0 API: Move node.exit() to process.exit(). 2009-09-28 18:48:18 +02:00
Ryan Dahl
c27d9f986a include utils in the repl. 2009-09-28 18:48:18 +02:00
Ryan Dahl
459d644a5a Don't delete timer object on clearTimeout.
I've heard delete is inefficient in v8. Better to let the garbage collector
take care of it naturally.
2009-09-28 18:48:18 +02:00
Ryan Dahl
095470854b Move tcp library to /tcp.js 2009-09-28 18:48:18 +02:00
Ryan Dahl
0955b0c8de Add forgotten file lib/utils.js 2009-09-28 18:48:17 +02:00
Ryan Dahl
83c9e64889 http.js license reference 2009-09-28 18:48:17 +02:00
Ryan Dahl
f6657c3c9d Move http library to /http.js 2009-09-28 12:36:36 +02:00
Ryan Dahl
7abad8b7b3 API: Move node.puts(), node.exec() and others to /utils.js 2009-09-28 12:06:30 +02:00
Ryan Dahl
c35dfdfd5e Remove api.xml from gitignore 2009-09-28 11:46:09 +02:00
Felix Geisendörfer
27c750154e Multipart stream parser 2009-09-27 16:58:56 +02:00
Ryan Dahl
3e7f0deef9 Add docbook documentation 2009-09-27 12:52:28 +02:00
Ryan Dahl
4f69871c17 Add node.inspect() and deprecate p(). 2009-09-27 12:33:44 +02:00
Ryan Dahl
9cd7864fd9 readFile/writeFile to read/write in file library.
as suggested by Bluebie.
2009-09-27 11:07:54 +02:00
Jeremy Lal
5e7a8dc75e Fixes for libeio wscript on Debian.
- Link libeio to pthread.
- Add -D_GNU_SOURCE to libeio wscript.
2009-09-27 10:55:18 +02:00
Ryan Dahl
45ea62a0f6 Changes to compile on Andrew Miller's very old machine 2009-09-26 15:11:31 +02:00
Ryan Dahl
0eb8d880f8 Remove -Werror on v8, for compiling on GCC 4.4 2009-09-25 08:40:47 +02:00
RayMorgan
028e24c9f5 When printing, check to see if value is undefined. If so, print nothing. 2009-09-24 22:16:07 -07:00
RayMorgan
7674bd5004 Added _ that is te result of the previous command. 2009-09-24 19:53:11 -07:00
RayMorgan
6915188a46 Enhanced the repl library.
Now supports:
- command options: .help, .break, .clear, .exit
- local vars and global functions
- ability to print 0, false and ""
- when value is a function, prints [Function]
- when object is circular, prints [Circular Object] instead of throwing an error
2009-09-24 18:56:37 -07:00
Ryan Dahl
2f56ccb45e bump version 2009-09-24 13:51:10 +02:00
Ryan Dahl
cfffa0bdd8 Clean up website a bit. 2009-09-24 13:44:25 +02:00
Ryan Dahl
ffded5ac86 Extract the good parts of node-repl into standalone library.
Now you can require("/repl.js") in your server to be able to examine it
while it's running.
2009-09-24 00:56:24 +02:00
Ryan Dahl
55a2e8271e Decrease default TCP backlog to 128
...after seeing http://lionet.livejournal.com/42016.html
2009-09-23 17:57:12 +02:00
Ryan Dahl
2d256f34c5 Change example at beginning of api.txt 2009-09-23 17:00:20 +02:00
Ryan Dahl
8c7babdf10 Syntax highlighting for <tt> elements. 2009-09-23 16:58:28 +02:00
Ryan Dahl
a3229ed7b7 Add documentation about requiring system modules. 2009-09-23 16:53:34 +02:00
Ryan Dahl
106287c368 Tighten window on timer test. 2009-09-23 16:40:04 +02:00
Ryan Dahl
8a5194b7cf cpplint.js file.{cc,h} 2009-09-23 16:33:24 +02:00
Ryan Dahl
c53aeb5a02 Call "connection" event after connection object is fully formed.
This became an apparent problem when adding setNoDelay because the command
was ignored if issued during the "connection" event.
2009-09-23 16:09:40 +02:00
Ryan Dahl
e0ec0036ca Add connection.setNoDelay() to disable Nagle algorithm. 2009-09-23 15:36:34 +02:00
Ryan Dahl
2df13c7310 Upgrade v8 to 1.3.13 2009-09-23 14:49:51 +02:00
Felix Geisendörfer
be3dddeec9 Syntax highlighting for api.html.
Asciidoc does not seem to support including custom JS, so this patch is a hack
for toc.js to dynamically include the needed CSS / JS. It should be ok unless
somebody has a better approach ...
2009-09-23 11:25:31 +02:00
Ryan Dahl
76f4962636 Bugfix: EIOPromise::Create was allocating two EIOPromise objects
This is because it would call the javascript initializer which executed
Promise::New, and then it would rewrap the handle. Instead I make an
explicit inheritance from EIOPromise to Promise.

This seems to fix a memory leak which was reported by Ray Morgan:
http://groups.google.com/group/nodejs/browse_thread/thread/e38949b1989da1d7
2009-09-23 00:17:50 +02:00
Ryan Dahl
663deb3828 delete[] instead of delete for arrays. 2009-09-23 00:17:49 +02:00
Ryan Dahl
8549994c4b Add readFile to '/file.js'
Thanks Hagen.
2009-09-22 17:28:04 +02:00
Ryan Dahl
a02ca7a590 Add writeFile() to /file.js
Initial patch by Tim Caswell.
2009-09-22 12:15:49 +02:00
Ryan Dahl
07792afe0a Remove "raw" encoding. Rename "raws" to "binary".
Deprecation warnings have been added to help the conversion to this new API.
2009-09-21 12:27:22 +02:00
Ryan Dahl
2db7d6755e Move node-repl to bin/node-repl 2009-09-20 20:54:19 +02:00
Ryan Dahl
cd70d4a9c0 Add "/file.js" buffered disk I/O object.
This is similar to the class node.File which was removed in
82cb1b5acb.

Needs documentation.
2009-09-20 20:42:23 +02:00
Ryan Dahl
4b8f503fac Move mjsunit.js to system module directory. 2009-09-20 18:19:33 +02:00
Ryan Dahl
7ddf1f569a Improve error message for requiring system modules. 2009-09-20 18:03:55 +02:00
Ryan Dahl
949f24305b Add node.error(); p() outputs to stderr. 2009-09-20 17:40:14 +02:00
Ryan Dahl
3311122ccb Throw ret value from wait() only if it's there. 2009-09-20 17:35:07 +02:00
Ryan Dahl
389c80aece return error from cat_promise in node.fs.cat 2009-09-20 17:34:27 +02:00
Ryan Dahl
c8b143bf30 Absolute path names for require() refer to node.libraryPaths 2009-09-19 17:21:12 +02:00
Ryan Dahl
5ddc4f5d0c bump version 2009-09-18 18:32:25 +02:00
Ryan Dahl
ab530bb211 Upgrade v8 to 1.3.11 2009-09-17 16:16:41 +02:00
Ryan Dahl
605b7e9763 Add node.installPrefix 2009-09-17 15:36:31 +02:00
Ryan Dahl
6f31a3763d Add more explanation to docs for request.finish(). 2009-09-17 15:15:05 +02:00
Ryan Dahl
b54fad9b3f Bugfix: node.fs.write() was stack allocating buffer.
Since the buffer is passed to the thread pool it needs to be heap allocated.
Thanks to Jon Crosby and Tim Caswell for debugging this.
2009-09-17 14:58:18 +02:00
Jon Crosby
e57c16bc2d Add failing spec for node.fs.write 2009-09-17 14:58:01 +02:00
Ryan Dahl
9db2e5f375 Default to utf8 encoding for node.fs.cat() 2009-09-15 22:41:25 +02:00
Ryan Dahl
16185ae57e update doc for node.fs.write() 2009-09-15 22:32:37 +02:00
Ryan Dahl
083d150bc4 Add node.exec() 2009-09-15 15:42:16 +02:00
Ryan Dahl
fdc136df69 Add documentation for promise.emitSuccess and emitError 2009-09-15 15:25:06 +02:00
Ryan Dahl
7fa694a3b6 fix typo on website 2009-09-14 22:44:25 +02:00
Ryan Dahl
5fdf9bbaa9 Remove unused variable in http.cc 2009-09-14 16:34:31 +02:00
Ryan Dahl
4f98e2deb3 Fix buffering logic for HTTP outgoing messages.
Was sending two packets instead of one for some short messages, and even 3,
for short chunked-encoded messages. Also use the more general Encode()
function for receiving HTTP bodies.

Gives ~6% improvement on "hello world" web server benchmarks.
2009-09-14 16:25:41 +02:00
Ryan Dahl
f389f923b8 Remove erroneously placed EV_DEFAULT_UC_ 2009-09-13 23:44:56 +02:00
Ryan Dahl
0d1ec5fdbe API: node.fs.read() takes a normal encoding parameter.
Removes node.UTF8, node.RAW, node.ASCII enum versions of the encodings.
node.fs.read() now supports "raws" encoding.
2009-09-13 18:31:17 +02:00
Ryan Dahl
d1a13bdd35 Fix default encoding for outgoing HTTP messages
Was causing send() to throw argument errors because arrays of ints would get
paired with the "raws" encoding. The bug was introduced in 8eb1294.
2009-09-13 18:19:03 +02:00
Ryan Dahl
ef300d19cb Bugfix: ReportException shouldn't forget the top frame. 2009-09-13 17:43:19 +02:00
Ryan Dahl
8eb1294f87 Bugfix: sendBody wasn't setting encoding 2009-09-13 12:44:09 +02:00
Ryan Dahl
69e8a01c58 Fix broken asciidoc section 2009-09-12 19:14:16 +02:00
Jeff Smick
bc6f381c98 Use "platform.architecture()" to find the proper architecture.
In Snow Leopard "platform.machine()" returns "i386" while
"platform.architecture()" returns ('64bit',''). Using information from both
we can determine the proper architecture

This reverts commit ea29e137b5 re-enabling the
64bit build on Macintosh.
2009-09-12 14:22:57 +02:00
Ryan
227638bac1 Lint 2009-09-12 14:21:37 +02:00
Ryan
dbe116ddfe API: Change arguments of emit(), emitSuccess(), emitError()
Instead of

  myemitter.emit("event", [arg1, arg2, arg3]);

the API is now

  myemitter.emit("event", arg1, arg2, arg3);

This change saves the creation of an extra array object for each event.
The implementation is also slightly more simple.
2009-09-12 14:21:37 +02:00
Ryan
97355f3613 spell check api.txt 2009-09-11 21:27:20 +02:00
Ryan
12bb0d46ce bump version 2009-09-11 21:06:50 +02:00
Ryan
5629fd574a Add doc note about 'raws' encoding 2009-09-11 21:04:02 +02:00
Ryan
d03c7e38e9 Just add the gernerated doc files. Make life easier. 2009-09-11 20:51:39 +02:00
Ryan
d851bf9a66 Revert "Add xsl files to doc directory so people can build docs easily"
This reverts commit 412b4636c8.
2009-09-11 20:47:45 +02:00
Ryan
412b4636c8 Add xsl files to doc directory so people can build docs easily 2009-09-11 20:34:55 +02:00
Ryan
8c41adb628 Add node-repl 2009-09-11 20:32:24 +02:00
Ryan
1910c113cc Add '--' to seperate v8 args from program args 2009-09-11 20:05:22 +02:00
Ryan
d6c9d31cb5 cpplint.py node.cc and node.h 2009-09-11 16:02:29 +02:00
Ryan
241950c1df Add isDirectory(), isFile(), isSocket(), ... methods to stats object.
Thanks to Felix Geisendörfer for the initial patch.
2009-09-11 13:41:47 +02:00
Ryan
3e4fc9f966 Add 'extern char **environ' so that the new ENV code compiles.
Problem appeared in dc39e82024.
2009-09-10 16:48:54 +02:00
Ryan
dc39e82024 Add access to user environment via ENV 2009-09-10 14:07:35 +02:00
Ryan
68dda0a7d8 Man page generation. 2009-09-10 13:40:38 +02:00
Ryan
8e5d4f9a69 Remove debug agent. It shouldn't have been commited!
Appeared accidentally in 6dd850aa.
2009-09-10 12:41:18 +02:00
Ryan
2337630746 Move arg parsing to beginning of main()
For faster "./node -v"
2009-09-10 12:34:51 +02:00
Ryan
d7e220cee1 Add a few fflush(stderr) calls to track down missing stacktraces. 2009-09-09 22:39:27 +02:00
Ryan
fcff66bf29 Upgrade v8 to 1.3.10 2009-09-09 22:01:54 +02:00
Ryan
efb2b703a6 Remove compiler warning with extra assert. 2009-09-09 18:06:58 +02:00
Ryan
393caeb4c9 Add Exception::Error where missing. 2009-09-09 17:35:59 +02:00
Ryan
8890070b88 Introduce "raws" encoding. Raw String.
This allows you to have binary data imported into your application via
strings instead of arrays of numbers! This needs testing before release.
2009-09-09 17:22:20 +02:00
Ryan
21a1b045f5 Byte stream to V8 decoding and encoding.
This does not (should not) change behavior.  Pulls those two functions
(encode/decode) out into node.cc.
2009-09-09 15:52:46 +02:00
Ryan
6dd850aa16 node.assert() was broken. 2009-09-08 14:59:43 +02:00
Ryan
063890b8da Internally use full paths when loading modules.
This completes shebang support begun in
6acac912dd.
2009-09-07 14:46:56 +02:00
Ryan
1a2696f10a Almost completely remove onExit and onLoad.
They were deprecated in 723c7d9f7c and
31265be4a6.

Still retaining error message.
2009-09-07 14:45:48 +02:00
Ryan
0407145c11 Exit the process on module load error. (temporary) 2009-09-07 14:13:32 +02:00
Ryan
86051ca5d2 Add note about sendBody buffering to docs 2009-09-07 12:56:10 +02:00
Ryan
94e627dc32 Add some links to the website 2009-09-07 12:54:08 +02:00
Ryan
2f46540d30 Create NODE_UNIXTIME macros 2009-09-07 12:53:44 +02:00
Ryan
ba6c5e38d5 bump version 2009-09-05 14:47:56 +02:00
Ryan
ea29e137b5 Hack for compiling on Snow Leopard.
I don't have access to this OS to fix the issue properly, so for the moment
I'm reverting back to 32bit build on Darwin. We changed to native 64bit in
8ddf930901.

Thanks to Johan Dahlberg and Tim Caswell for reporting and debugging this.
2009-09-05 14:40:12 +02:00
Ryan
485a9c1487 Small change to website index.html 2009-09-05 14:39:24 +02:00
Ryan
9dbd92476e Bugfix: Trap exceptions in URIParser.
A user was able to crash chat.tinyclouds.org by sending it a malformed URL!
Not good.
2009-09-04 17:42:00 +02:00
Ryan
734e86b9e5 bump version 2009-09-04 12:35:30 +02:00
Ryan
733ee426dc Fix slowness in debug run of test-tcp-many-clients
I'm not sure what is actually causing

  node_g test/mjsunit/test-tcp-many-clients.js

to run slowly, but I traced the problem to
afd9e714d3.
Somehow it has to do with promoting the compilation of src/util.js. That
change wasn't actually intended to be included in afd9e7 commit anyway, so
I'm reverting it here.
2009-09-04 12:15:21 +02:00
Ryan
2097b9d2e5 Upgrade evcom - disable EPIPE error output. 2009-09-04 11:46:56 +02:00
Ryan
1bd5277233 Add test-mkdir-rmdir.js 2009-09-04 11:46:31 +02:00
Ryan
b6eed30379 Sort files in readdir test. 2009-09-03 21:59:31 +02:00
Ryan
3736bf9f49 Add node.fs.mkdir() 2009-09-03 21:57:15 +02:00
Ryan
9b3e2ae192 Add node.fs.readdir() 2009-09-03 21:32:27 +02:00
Ryan
747d6723aa Clean up eio wrappers. Create EIOPromise. 2009-09-03 21:32:21 +02:00
Ryan
c13773a71f Clean up text on website. 2009-09-03 18:12:50 +02:00
Ryan
1645b8f8b0 Asyncly do getaddrinfo() on Apple. 2009-09-03 16:01:45 +02:00
Ryan
1df6d61208 Upgrade libeio, increase xthread stacksize to 64kb.
64kb seems to be the magic number for getaddrinfo() to work on Macintosh.
2009-09-03 15:59:48 +02:00
Ryan
342da69701 Add extension API documentation 2009-09-03 15:00:06 +02:00
Ryan
aefbd57514 Add stack to promise.wait().
The problem was that if promise A was waiting and promise B was created and
then also told to wait (from some callback coming off the event loop), and
then promise A finished, promise B's wait would return. Promise A's wait
would not return until promise B was finished. This is incorrect.

To solve this issue properly, one probably needs to allocate separate
execution stacks. I use, instead, Poor Man's Coroutines. We continue to use
the main execution stack and force promises created most recently to return
first.

That is even if Promise A finishes first, neither wait() returns. Not until
Promise B finishes, will its wait() return. After that is complete, Promise
A's wait() will return.

This introduces the problem of growing the "wait stack" infinitely. Thus
I've added a strong warning to the documentation only to use this operation
sparingly. require() and include() seem to be the proper use case for such a
thing: they are called usually at program start up - they don't take too
long to finish and they won't be called so often.

Let's experiment with this stop-gap. If the infinite promise stack becomes a
problem for many, then I will remove promise.wait() entirely or perhaps only
use it for thread pool events.
2009-09-03 10:48:39 +02:00
Ryan
8ddf930901 Build natively on x64.
Had to add some waf hackery to override V8's architecture choice. They
probably have a reason for defaulting still to IA32, but all tests are
passing for me, and it makes it easier on users-and I think chrome is using
x64 builds too. So let's go for it!
2009-09-02 20:19:52 +02:00
Ryan
82d986db24 Add limits.h to src/node.cc for PATH_MAX 2009-09-02 20:18:57 +02:00
Ryan
97ce138621 Upgrade V8 to 1.3.9 2009-09-02 11:13:46 +02:00
Ryan
78bb53b009 Set module.loaded=true for dll modules. 2009-09-01 15:43:56 +02:00
Ryan
ed9c3362ee Remove --lib option since there is no more libnode 2009-09-01 15:28:10 +02:00
Ryan
8152f9cff2 Revert static library build.
Not necessary to build dll modules after all.
2009-09-01 14:15:29 +02:00
Michael Carter
8ea6adcae6 Feature: add node.cwd() to access the current working directory. 2009-09-01 11:39:30 +02:00
Ryan
fbf65b58f9 Use Error exceptions where possible in net.cc and file.cc 2009-08-31 18:57:01 +02:00
Ryan
3862fdade4 Throw Error exceptions from node.dlopen() 2009-08-31 18:48:47 +02:00
Ryan
afd9e714d3 Stack traces for mjsunit errors, better error reporting function.
The error reporting function tries to look at the "stack" element of the
exception.
2009-08-31 18:42:50 +02:00
Ryan
7beea2cd5f Upgrade evcom; Add setTimeout method to node.tcp.Connection
The default timeout is 60 seconds, but it can now be changed.

evcom upgrade includes fixes to force_close.
2009-08-31 18:26:50 +02:00
Ryan
18a1923604 Update test script to use new debug build's name: node_g 2009-08-31 16:12:27 +02:00
Ryan
a97dce7523 Build static executable.
- Fix a few errors with node.dlopen()

- Report errors to stderr (this should probably be a separate commit, but
  whatever)
2009-08-31 11:45:44 +02:00
Ryan
b73264d9b3 Add command line arguments for accessing build flags.
node --cflags
node --libs

At the expense of some WAF nastiness.
2009-08-27 16:08:47 +02:00
Ryan
4d92199d18 Add pkgconfig files to help with dll builds. 2009-08-27 16:08:47 +02:00
Ryan
2b6d72431b First attempt at node.dlopen
Compiled first working 'hello world' module with this config
2009-08-27 16:08:40 +02:00
Ryan
31db4f1ed8 bump version 2009-08-27 12:31:52 +02:00
Ryan
00a03dfee2 Fix text on index.html 2009-08-27 12:23:53 +02:00
Ryan
ad9d683f9f API: rename node.Process to node.ChildProcess
This is to avoid confusion with the global "process" object, especially for
the instances of node.Process.
2009-08-26 22:36:45 +02:00
Ryan
116f4dea05 lint 2009-08-26 22:14:45 +02:00
Ryan
723c7d9f7c Replace onExit() with process.addListener("exit")
- Update documentation.

- Depreciation message for onExit().
2009-08-26 22:14:44 +02:00
Ryan
6025da2153 Introduce 'process' object. Also is the global object. 2009-08-26 22:14:44 +02:00
Ryan
31265be4a6 Depreciate onLoad 2009-08-26 22:14:44 +02:00
Ryan
79f121044c Synchronous module loading.
`include` and `require now` call `promise.wait` on their retrieval functions
making them synchronous.  Introduce `include_async` and `require_async` to
do asynchronous retrievals.

`include_async` and `require_async` need testing and documentation.

Update documentation for include, require().  I am mostly removing
information about onLoad(). onLoad is to be depreciated.
2009-08-26 22:14:01 +02:00
Ryan
7e7deed510 Add node.assert for internal debugging. 2009-08-26 18:02:13 +02:00
Ryan
18d0511777 promise.block() renamed to promise.wait()
promise.wait() now returns the arguments of the "success" event.  If there
was only a single argument, then it is returned.  If there was more than
one, they are returned as an array.  If there was an error, it is thrown.
See documentation.
2009-08-26 17:28:49 +02:00
Ryan
51addf19d8 Improve Promise documentation. 2009-08-26 11:25:53 +02:00
Ryan
8781b969e9 Modify website layout. 2009-08-26 11:25:10 +02:00
Ryan
db42ad959d API: All EventEmitters emit "newListener" when listeners are added.
The "newListener" event will also be emitted for listeners to "newListener".
Maybe useful?
2009-08-25 17:28:06 +02:00
Ryan
b5a1585470 Restyle website/api.html. Now looks like the front page.
Made a few other little corrections too.
2009-08-25 17:25:39 +02:00
Ryan
b5b65ddcd7 Upgrade v8 to 1.3.7 2009-08-25 13:47:18 +02:00
Ryan
b0a362a727 Fix coupling problems on OSX 2009-08-25 13:33:19 +02:00
Ryan
aa664c8040 Add close() to coupling pump. Wasn't getting EOF. 2009-08-25 12:56:54 +02:00
Ryan
19f182a39f Experimental support for Promise.block() 2009-08-25 04:25:35 +02:00
Ryan
82cb1b5acb API: Remove buffered file object (node.File)
With the addition of non-libeio stdio (17c6a67f15)
this class is no longer being used internally. It has proved buggy and isn't
full-featured enough to be very useful.  Since it's implemented entirely in
javascript it will be easy for someone to extra into their own library if
needed.
2009-08-25 01:18:44 +02:00
Ryan
8658999c7d Refactor node.Process to take advantage of evcom_reader/writer. 2009-08-25 01:06:49 +02:00
Ryan
17c6a67f15 Introduce node.stdio
Remove old stdout, stderr, stdin objects.
2009-08-24 21:20:26 +02:00
Ryan
0727fcc9ed Speed up test-tcp-throttle.js 2009-08-24 21:11:02 +02:00
Ryan
69a9f66b07 Add sha1 hashes to ChangeLog 2009-08-24 13:02:55 +02:00
Ryan
4fab9dfc36 Remove outdated todo list 2009-08-24 13:00:45 +02:00
Ryan
1bbd5c6d55 Add node node_g to gitignore. 2009-08-24 12:59:17 +02:00
Ryan
316e2833f0 Use flat object instead of array-of-arrays for HTTP headers.
E.G. { "Content-Length": 10, "Content-Type": "text/html" } instead of
[["Content-Length", 10], ["Content-Type", "text/html"]].
The main reason for this change is object-creation efficiency.

This still needs testing and some further changes (like when receiving
multiple header lines with the same field-name, they are concatenated with a
comma but some headers ("Content-Length") should not be concatenated ; the
new header line should replace the old value).

Various thoughts on this subject:
http://groups.google.com/group/nodejs/browse_thread/thread/9a67bb32706d9efc#
http://four.livejournal.com/979640.html
http://mail.gnome.org/archives/libsoup-list/2009-March/msg00015.html
2009-08-23 12:32:49 +02:00
Ryan
9c97b1db30 bump version 2009-08-22 13:07:31 +02:00
Ryan
a8813fcdf5 evcom upgrade - ignore sigpipe. remove error output. 2009-08-22 12:04:45 +02:00
Ryan
a73998d6f4 bump version 2009-08-21 18:03:15 +02:00
Kevin van Zonneveld
8489bdbaeb Buggy connections could crash node.js. Now check connection before sending data every time
http://groups.google.com/group/nodejs/browse_thread/thread/16abfa87c32408f3

We have our node.js server monitored by monit, however it seems monit is pretty
agressive / quick about closing its connection and thus we've gotten into a
loop of errors like this:

    at #<a ServerResponse>.flush
    at #<a ServerResponse>.sendBody
    at [object Object].json
    at [object Object].[anonymous]
    at [object Object].[anonymous]
    at [object Object].[anonymous]
http.js:353: Socket is not open for writing
      connection.send(out, out.encoding);
                 ^

Below is a patch that basically cause flushMessageQueue to check the connection
state for each item in the queue rather than just a single time in the
beginning.
2009-08-21 17:54:10 +02:00
Ryan
ed3602dddc Sync evcom 2009-08-21 14:53:58 +02:00
Ryan
f7f11352b7 Don't Close TCP Connection/Server on destruction.
If the connection is open when the destructor is called it's a bug! Don't
want to try to compensate for bugs.
2009-08-21 14:47:33 +02:00
Ryan
048a1b8b9e Upgrade v8 to 1.3.6 2009-08-21 13:13:04 +02:00
Ryan
90ac9ab078 Remove connnection.fullClose() from documentation.
This function was removed in 368ea93bfe.
2009-08-19 17:46:44 +02:00
Ryan
368ea93bfe Upgrade evcom - fix API issues. 2009-08-19 17:41:32 +02:00
Ryan
0cec74d03d Upgrade v8 to 1.3.5 2009-08-19 16:37:15 +02:00
Ryan
b590a45849 Return the EventEmitter from addListener for chaining.
http://groups.google.com/group/nodejs/browse_thread/thread/13708eacedb40b36
2009-08-19 13:29:22 +02:00
Abe Fettig
53b3d6be35 Bugfix: stdin fd (0) being ignored by node.File.
In the case of stdin options.fd is 0, which is considered false, therefore fd
gets set to null intead of 0.
http://groups.google.com/group/nodejs/msg/80849f6aa0b0eaa0
2009-08-19 12:58:02 +02:00
Ryan
7aaab320b3 API: tcp.Connection "disconnect" event renamed to "close".
More semantic, since the event will be emitted on connection error,
when the connection was ever established.
2009-08-14 12:51:46 +02:00
Ryan
95f9209966 Clarify some of the TCP API documentation. 2009-08-14 12:43:46 +02:00
Ryan
0f888ed6de bump version 2009-08-13 15:52:55 +02:00
Ryan
b41ea5289e Upgrade libev to 3.8 2009-08-13 15:07:37 +02:00
Ryan
9dc621f83a Upgrade v8 to 1.3.4 2009-08-13 15:06:34 +02:00
Ryan
dd5ae3183b Enable test-tcp-many-clients. 2009-08-13 15:05:02 +02:00
Ryan
af40ae6b8f Remove debugging messages in HTTP client 2009-08-13 15:03:28 +02:00
Ryan
79ff085c4a Upgrade v8 to 1.3.3 2009-08-13 13:52:47 +02:00
Ryan
3b0408ec1c Sync evcom after refactor; fix binding issues 2009-08-13 13:47:16 +02:00
Ryan
4253baf4ab Sync evcom. 2009-08-10 12:54:57 +02:00
Ryan
ca0dda797a (evcom) SOL_SOCKET got renamed in socket,stream renaming
This was breaking the build on Macintosh.
2009-08-10 12:46:22 +02:00
Ryan
738d20f6f0 (evcom) Add fix for pausing against big buffers.
discussion:
http://groups.google.com/group/nodejs/browse_thread/thread/11a920da4d0ed21d
2009-08-10 12:32:54 +02:00
Ryan
0638a3a3ab Add IncomingMessage.prototype.pause() and resume(). 2009-08-09 19:16:25 +02:00
Ryan
94e8721771 Add connection.readPause() and connection.readResume() 2009-08-09 19:12:12 +02:00
Ryan
7d60998ee1 Upgrade evcom
Made API changes in evcom and had to make minor change src/net.cc to comply.
2009-08-09 18:42:06 +02:00
Ryan
ed8c43d2f3 Bugfix: Negative ints in HTTP's on_body and node.fs.read()
Similar to the error fixed in
9d3ed1bb92.

Reported by Felix Geisendörfer.
2009-08-09 18:10:16 +02:00
Ryan
75fc21537a Bugfix: response.setBodyEncoding("ascii") not working.
This is same error that was fixed in 216fb3b9b2.

Reported by Felix Geisendörfer.
2009-08-09 18:04:10 +02:00
Ryan
65ec2d5db4 Fix http benchmark. Wasn't correctly dispatching. 2009-08-08 21:51:28 +02:00
Ryan
abaab2ce9b Add -m32 gcc flag to udns build.
This is a temporary fix until V8 supports 64bit systems natively.
2009-08-08 16:58:06 +02:00
Ryan
d8226af7f5 Upgrade http_parser to v0.2 2009-08-07 18:25:25 +02:00
Ryan
6ffe389c97 Add SHA1 hash values to ChangeLog and fix formating. 2009-08-07 15:45:11 +02:00
Ryan
78024fa689 Remove extra ev_timer_stop() in src/dns.cc 2009-08-07 14:10:40 +02:00
Ryan
0486c091e1 (evcom) Increase recv buffer from 4 bytes (!!!) to 8192 2009-08-06 15:08:07 +02:00
Ryan
7464d42310 bump version 2009-08-06 14:01:26 +02:00
Ryan
7946e98c1f Delete v8 file that was removed in 1.3.2 2009-08-06 13:59:09 +02:00
Ryan
8bb8b4b570 Upgrade v8 to 1.3.2 2009-08-06 13:36:45 +02:00
Ryan
b849d50288 Remove unused symbols. 2009-08-06 13:33:42 +02:00
Ryan
216fb3b9b2 Bugfix: node.http.ServerRequest.setBodyEncoding('ascii') not working
Pointed out by Felix Geisendörfer.
http://groups.google.com/group/nodejs/browse_thread/thread/d061fe62eba6d3b3#
2009-08-06 13:29:24 +02:00
Ryan
9b3baf3d50 Bugfix: node.encodeUtf8 was broken. (Connor Dunn)
http://groups.google.com/group/nodejs/browse_thread/thread/5ad0660a0959d885#
2009-08-06 13:17:30 +02:00
Ryan
fb7dd02929 Add ranlib to udns Makefile
Thanks to Urban Hafner.
http://groups.google.com/group/nodejs/browse_thread/thread/25867dba9db11d8
2009-08-06 13:03:57 +02:00
Ryan
e111ccc014 Add Felix Geisendörfer's HTTP stress test.
Does not pass on Macintosh and FreeBSD.
2009-08-05 11:17:26 +02:00
Ryan
396ed96b2d Upgrade evcom - fix accepting too many connections issue 2009-08-04 14:51:41 +02:00
Ryan
2312ff4b23 Apply patch for V8 bug 414
http://groups.google.com/group/nodejs/browse_thread/thread/25867dba9db11d8
http://code.google.com/p/v8/issues/detail?id=414
http://codereview.chromium.org/159659
2009-08-04 12:05:59 +02:00
Ryan
6acac912dd Initial support for shebang.
There are some issues with loading modules from shebang-executed scripts
that will still need to be addressed, but this works for simple single
script situations.
2009-08-03 18:42:56 +02:00
Ryan
11df252cb9 Add simple command line switches 2009-08-03 18:21:34 +02:00
Ryan
1bf9be6b37 Add node.version 2009-08-03 17:51:35 +02:00
Ryan
e10fbab00f bump version 2009-08-01 14:56:45 +02:00
Ryan
207bd3c764 Add header to src/dns.cc to compile on FreeBSD. 2009-08-01 12:58:39 +02:00
Ryan
c745383b31 Add examples of reading a file to documentation. 2009-07-31 20:01:49 +02:00
Ryan
4f46c47773 node.fs.File was not passing args to promise callbacks.
Reported by Jacob Rus.
2009-07-31 19:48:19 +02:00
Ryan
9d3ed1bb92 Bugfix: negative integers in raw encoding stream.
Add test. Reported by Tim Caswell.
2009-07-31 19:16:08 +02:00
Ryan
e25afc35bd Hack to fix module line numbers in stack traces.
This code is going to be refactored with the introduction of the "process"
object. This is just temporary.
2009-07-31 18:49:30 +02:00
Ryan
b27f8ba06d Default to chunked for client requests without C-Length.
Also add test. Reported by Felix Geisendörfer.
2009-07-31 18:34:27 +02:00
Ryan
2ebd692151 Upgrade V8 to 1.3.1 2009-07-31 14:36:48 +02:00
Ryan
5373c6869a node.tcp.Server's backlog option is now an argument to listen() 2009-07-31 11:59:36 +02:00
Ryan
4db8bb9375 Simplify the DNS usage example. 2009-07-30 15:54:38 +02:00
Ryan
41d89f611f Add DNS API.
Missing functional tests. I'm not sure how to do tests because I don't want
to rely on the fact that users have an internet connection.
2009-07-28 12:36:41 +02:00
Ryan
77d407df28 bump version 2009-07-27 15:48:16 +02:00
Ryan
d41197e02c Disable test-tcp-many-clients.js. It's broken on macintosh - don't want to fix right now. 2009-07-27 15:30:07 +02:00
Ryan
0fb0af3a6c Rename evnet to evcom. 2009-07-25 17:52:26 +02:00
Ryan
842eaf446d Move EventEmitter.prototype.emit() completely into C++.
This shows a healthy speed up.
2009-07-24 22:23:50 +02:00
Ryan
4aac515202 Remove unused 'using namespace std' lines. 2009-07-24 22:22:08 +02:00
Ryan
b3e828991b Remove unused symbols from http.cc. 2009-07-24 20:42:54 +02:00
Ryan
854538d094 Missing HandleScope in GetMethod(). Thanks Brian. 2009-07-24 20:20:01 +02:00
Ryan
d2222efc5e Add note to README about wiki page 2009-07-24 15:14:59 +02:00
Ryan
50c0d16208 Fix memory leak. It was only a missing HandleScope in Emit()!
This change also tries to optimize Emit by looping through the listeners in
C++. The javascript version of this function is still there and being used,
but only by javascript code. Not an ideal solution - there should only be
one implementation - however for now it seems to help.

This doesn't solve all of the memory leaks that we're experiencing, there
seems to be another subtle problem.
2009-07-24 15:11:18 +02:00
Ryan
78aaf8df67 Remove unused static object. 2009-07-24 01:15:21 +02:00
Ryan
646829262f Fix evnet_buf size calculation for V8::AdjustAmountOfExternalAllocatedMemory(). 2009-07-23 18:36:28 +02:00
Ryan
dd1750f573 Clean up little errors in events.js 2009-07-23 18:35:43 +02:00
Ryan
0462b5d1ec ObjectWrap: MakeWeak again after each Weak callback. 2009-07-23 18:35:03 +02:00
Ryan
b1588e78d9 Fix utf8 scripts, add test. Thanks Urban. 2009-07-20 21:22:19 +02:00
Ryan
e8a5d3d311 remove the callback from node.cat, node.fs.cat 2009-07-20 21:09:37 +02:00
Ryan
b07dc31e1b root_module should be a local variable 2009-07-20 18:30:15 +02:00
Ryan
2a695a9721 Array.prototype.encodeUtf8 renamed to node.encodeUtf8(array) 2009-07-20 18:19:13 +02:00
Ryan
88e9a5f122 Upgrade V8 to 1.2.14 2009-07-20 13:18:42 +02:00
Ryan
f4dfbe37a3 Upgrade libev to 3.7 2009-07-20 13:01:40 +02:00
Ryan
e7bbda0b7f Attach connections on Macintosh too. 2009-07-20 12:52:03 +02:00
Ryan
eb10553634 Move node.inherit, node.path, node.cat to new file: util.js 2009-07-16 17:19:36 +02:00
Ryan
22e85cbc0b Fix 'make test-debug' 2009-07-16 16:54:55 +02:00
Ryan
edbae656d6 Add IsNearDeath assertion to ObjectWrap destructor 2009-07-16 15:43:03 +02:00
Ryan
56c785ceae small clean ups to http.js 2009-07-16 11:23:37 +02:00
Ryan
8b819d8546 Upgrade evnet. 2009-07-15 17:52:38 +02:00
Ryan
0292dea847 Better error output for socket errors. Temporary. 2009-07-15 17:52:11 +02:00
Ryan
1b6bbc619d Bugfix: Server-side clients not attached between creation and on_connect.
Solution is to manually add Attach() to OnConnection.

For client side it seems there is no Detach() being called after NS
resolution? Otherwise I would have removed it. That was another bug.

Note: We don't want to modify evnet's behavior to have on_connect called
directly when the socket is accepted. evnet needs to support SSL, and
on_connect is supposed to signal that the SSL connection is established. The
point here is that being "connected" and being "attached" to the event loop
are two different things. SSL stuff may be transmitted when a socket is not
"connected" but it must always be attached.
2009-07-15 17:36:30 +02:00
Ryan
fc02221393 Remove unused variable from ~Connection 2009-07-15 17:36:30 +02:00
Ryan
5e2a6f8c46 Upgrade evnet to fix close() bug. Add test for bug.
evnet wasn't properly closing sockets if they didn't have data to write.
2009-07-15 07:54:08 +02:00
Ryan
ef09b2c65d large http.js refactor 2009-07-14 18:31:50 +02:00
Ryan
216e6204f0 http: Add IncomingMessage as abstract base class of ServerReq ClientRes 2009-07-14 12:03:47 +02:00
Ryan
116069fab3 upgrade http_parser 2009-07-14 00:00:07 +02:00
Ryan
2819e3bcb8 Replace some printf() in src/net with asserts 2009-07-13 16:38:55 +02:00
Ryan
f99fbc61e1 Add 'close' event to tcp.Server 2009-07-13 16:38:55 +02:00
Ryan
05d6319fa0 Add benchmark scripts.
To use the benchmarks:

  node benchmarks/run.js

or:

  make benchmark

The numbers reported are the elapsed milliseconds the script took to
complete. Currently only benching HTTP code and timers.
2009-07-13 16:38:55 +02:00
Ryan
bf6a457f64 Use assert() for Unwrap checks instead of JS error. 2009-07-13 16:38:55 +02:00
Ryan
041af82b8c Bugfix: Sockets not properly reattached if reconnected during disconnect event.
The problem was that Connection::on_close was calling Detach() directly
after executing the "disconnect" event. Since we had a boolean attach count,
this was leaving sockets detached even if they had reattached in during the
event.

 * Added many asserts in http.cc and net.cc to ensure that sockets are
   connected when they should be.

 * Changed ObjectWrap to use a reference count instead of boolean attached_
   value.

 * Fixed similar bug in Timer.
2009-07-13 16:38:55 +02:00
Ryan
d4fcc0a753 add bug to TODO 2009-07-13 16:38:54 +02:00
Ryan
996d5ef5f1 Add res.client to ClientResponse 2009-07-13 16:38:54 +02:00
Ryan
c5ab0d5a80 Upgrade liboi, which is now called evnet. 2009-07-13 16:38:25 +02:00
Ryan
51e77c37b5 Do not call Detach() from Server::~Server. 2009-07-11 11:43:06 +02:00
Ryan
22c3a1e2a5 Templatize ObjectWrap::Unwrap. Remove NODE_UNWRAP macro. 2009-07-10 13:57:58 +02:00
Ryan
1fc4dce08b Simplify and cleanup ObjectWrap.
Simplify and inline ObjectWrap::Wrap

    Inline and clean up ObjectWrap::Unwrap

    Move ObjectWrap into its own file.

    Remove handle from ObjectWrap constructor. add obj->Wrap(handle)

    Simplify Attach/Detach in ObjectWrap

    Remove ObjectWrap::InformV8ofAllocation. (Too messy/complex.)
2009-07-10 13:38:53 +02:00
Joshaven Potter
4b9f26c51a validate js 2009-07-01 02:33:08 +02:00
Ryan
0640517a91 fix example on website 2009-06-30 15:56:52 +02:00
Ryan
813b53938b bump version 2009-06-30 15:18:05 +02:00
Ryan
94f03be728 Add changelog 2009-06-30 15:10:15 +02:00
Ryan
7879e7fd25 small cleanups 2009-06-30 13:58:30 +02:00
Ryan
8047b912c0 Change 'new node.tcp.Connection' to 'node.tcp.createConnection' 2009-06-30 13:56:52 +02:00
Ryan
d56552dc66 Remove node.Process constructor from API 2009-06-30 13:46:35 +02:00
Ryan
a3d77ee4e7 Add new documentation (using asciidoc!) 2009-06-30 13:27:25 +02:00
Ryan
a623d763c1 Add -m32 flags for compiling on 64bit machines.
These can be removed after v8 supports x64.
2009-06-29 21:17:06 +02:00
Ryan
e4ba665c87 Fix ref/unref problem. Was doing opposite of what I should. 2009-06-29 20:53:54 +02:00
Ryan
88ad880556 Add new test for node.fs.stat() 2009-06-29 14:11:26 +02:00
Ryan
e7ad8ab4b0 Clean up some of the event handling code 2009-06-29 14:11:01 +02:00
Ryan
d428eff023 Snakecase events . 2009-06-29 13:18:30 +02:00
Ryan
c2bdc01870 Bad array index in AfterStat() 2009-06-29 13:17:49 +02:00
Ryan
e763efdadf Upgrade v8 to 1.2.10 and libev to 3.6 2009-06-29 10:55:05 +02:00
Ryan
e876d6629e Fix unused variable warnings. 2009-06-28 20:11:55 +02:00
Ryan
89320036a8 Timer::RepeatSetter wasn't getting the right value 2009-06-28 19:58:13 +02:00
Ryan
4787a41b84 Fix Process::MaybeShutdown's return type 2009-06-28 19:55:35 +02:00
Ryan
c9cb41cf80 Wrong number of arguments being passed to emit in AfterOpen 2009-06-28 19:34:54 +02:00
Ryan
65324866bc Implement Promises for file i/o 2009-06-28 19:08:27 +02:00
Ryan
7cd09874c6 Add Promise class 2009-06-28 19:08:27 +02:00
Ryan
ed926da691 Remove onEvent compatibility 2009-06-28 19:08:26 +02:00
Ryan
80bf451e6e Use EventEmitter for node.Process 2009-06-28 19:08:26 +02:00
Ryan
70fe920fb5 Use events for all HTTP messages.
This is a rather large refactor! Mostly for the better side. I've had to
remove some functionality like req.interrupt(). A lot of other work is left
messy or incomplete.
2009-06-28 19:08:26 +02:00
Ryan
20c0e1fdfb events for http.Server 2009-06-28 19:08:26 +02:00
Ryan
ed3d6a63d5 Further expand EventEmitter to TCP and HTTP
The constructor for TCP servers can no longer take a connection handler for
purely technical reasons. (The constructor for EventEmitter is implemented
in C++ but addListener is in javascript, and I don't want to make too many
C++ -> Javascript references.) Thus I introduce new constructor methods to
ease the creation of the servers:

  node.tcp.createServer()
  node.http.createServer()

These work almost the same as the old constructors.

In general we're working towards a future where no constructors are
publicly exposed or take arguments.

The HTTP events like "on_uri" are not yet using the event interface.
onMessage still is a constructor - but this will change soon.
2009-06-28 19:08:26 +02:00
Ryan
b4af3b9fb5 Timers on Events 2009-06-28 19:08:25 +02:00
Ryan
2ecd7ffe54 in the middle putting in event code. broken. 2009-06-28 19:08:25 +02:00
Ryan
bd952ac61e Add some notes about extent of HTTP API 2009-06-27 19:06:29 +02:00
Ryan
b77e603e04 add irc channel to website 2009-06-27 18:43:46 +02:00
Ryan
9615c93d2d Add make test-all 2009-06-27 00:49:47 +02:00
Ryan
be963d68af add more detail to req.uri documentation 2009-06-27 00:43:03 +02:00
Ryan
5ab93502d0 Fix issue in 5b7fb10 2009-06-27 00:13:37 +02:00
Ryan
5b7fb1003c Add failing test. Process spawning loop.
I think this is the issue Felix Geisendoerfer is reporting:
http://groups.google.com/group/nodejs/browse_thread/thread/efbae1ec1e67786c
2009-06-27 00:11:20 +02:00
2064 changed files with 782979 additions and 80549 deletions

10
.gitignore vendored
View File

@@ -2,5 +2,13 @@ build
.waf*
tags
.lock-wscript
Makefile
*.pyc
doc/api.xml
tools/nodejs.pc
tmp/
node
node_g
*.swp
.benchmark_reports
/.project
/.cproject

196
AUTHORS Normal file
View File

@@ -0,0 +1,196 @@
# Authors ordered by first contribution.
Ryan Dahl <ry@tinyclouds.org>
Urban Hafner <urban@bettong.net>
Joshaven Potter <yourtech@gmail.com>
Abe Fettig <abefettig@gmail.com>
Kevin van Zonneveld <kevin@vanzonneveld.net>
Michael Carter <cartermichael@gmail.com>
Jeff Smick <sprsquish@gmail.com>
Jon Crosby <jon@joncrosby.me>
Felix Geisendörfer <felix@debuggable.com>
Ray Morgan <rmorgan@zappos.com>
Jérémy Lal <kapouer@melix.org>
Isaac Z. Schlueter <i@izs.me>
Brandon Beacher <brandon.beacher@gmail.com>
Tim Caswell <tim@creationix.com>
Connor Dunn <connorhd@gmail.com>
Johan Sørensen <johan@johansorensen.com>
Friedemann Altrock <frodenius@gmail.com>
Onne Gorter <onne@onnlucky.com>
Rhys Jones <rhys@wave.to>
Jan Lehnardt <jan@apache.org>
Simon Willison <simon@simonwillison.net>
Chew Choon Keat <choonkeat@gmail.com>
Jered Schmidt <tr@nslator.jp>
Michaeljohn Clement <inimino@inimino.org>
Karl Guertin <grayrest@gr.ayre.st>
Xavier Shay <xavier@rhnh.net>
Christopher Lenz <cmlenz@gmail.com>
TJ Holowaychuk <tj@vision-media.ca>
Johan Dahlberg <jfd@distrop.com>
Simon Cornelius P. Umacob <simoncpu@gmail.com>
Ryan McGrath <ryan@venodesigns.net>
Rasmus Andersson <rasmus@notion.se>
Micheil Smith <micheil@brandedcode.com>
Jonas Pfenniger <jonas@pfenniger.name>
David Sklar <david.sklar@gmail.com>
Charles Lehner <celehner1@gmail.com>
Elliott Cable <me@ell.io>
Benjamin Thomas <benjamin@benjaminthomas.org>
San-Tai Hsu <v@fatpipi.com>
Ben Williamson <benw@pobox.com>
Joseph Pecoraro <joepeck02@gmail.com>
Erich Ocean <erich.ocean@me.com>
Alexis Sellier <self@cloudhead.net>
Blaine Cook <romeda@gmail.com>
Stanislav Opichal <opichals@gmail.com>
Aaron Heckmann <aaron.heckmann@gmail.com>
Mikeal Rogers <mikeal.rogers@gmail.com>
Matt Brubeck <mbrubeck@limpet.net>
Michael Stillwell <mjs@beebo.org>
Yuichiro MASUI <masui@masuidrive.jp>
Mark Hansen <mark@markhansen.co.nz>
Zoran Tomicic <ztomicic@gmail.com>
Jeremy Ashkenas <jashkenas@gmail.com>
Scott González <scott.gonzalez@gmail.com>
James Duncan <james@joyent.com>
Arlo Breault <arlolra@gmail.com>
Kris Kowal <kris.kowal@cixar.com>
Jacek Becela <jacek.becela@gmail.com>
Rob Ellis <kazoomer@gmail.com>
Tim Smart <timehAndGod@gmail.com>
Herbert Vojčík <herby@mailbox.sk>
Krishna Rajendran <krishna@emptybox.org>
Nicholas Kinsey <pyrotechnick@feistystudios.com>
Scott Taylor <scott@railsnewbie.com>
Carson McDonald <carson@ioncannon.net>
Matt Ranney <mjr@ranney.com>
James Herdman <james.herdman@gmail.com>
Julian Lamb <thepurlieu@gmail.com>
Brian Hammond <brian@fictorial.com>
Mathias Pettersson <mape@mape.me>
Trevor Blackwell <tlb@tlb.org>
Thomas Lee <thomas.lee@shinetech.com>
Daniel Berger <code+node@dpbis.net>
Paulo Matias <paulo.matias@usp.br>
Peter Griess <pg@std.in>
Jonathan Knezek <jdknezek@gmail.com>
Jonathan Rentzsch <jwr.git@redshed.net>
Ben Noordhuis <info@bnoordhuis.nl>
Elijah Insua <tmpvar@gmail.com>
Andrew Johnston <apjohnsto@gmail.com>
Brian White <mscdex@mscdex.net>
Aapo Laitinen <aapo.laitinen@iki.fi>
Sam Hughes <sam@samuelhughes.com>
Orlando Vazquez <ovazquez@gmail.com>
Raffaele Sena <raff367@gmail.com>
Brian McKenna <brian@brianmckenna.org>
Paul Querna <pquerna@apache.org>
Ben Lowery <ben@blowery.org>
Peter Dekkers <soderblom.peter@gmail.com>
David Siegel <david@artcom.de>
Marshall Culpepper <marshall.law@gmail.com>
Ruben Rodriguez <cha0s@therealcha0s.net>
Dmitry Baranovskiy <Dmitry@Baranovskiy.com>
Blake Mizerany <blake.mizerany@gmail.com>
Jerome Etienne <jerome.etienne@gmail.com>
Dmitriy Shalashov <skaurus@gmail.com>
Adam Wiggins <adam@heroku.com>
Rick Olson <technoweenie@gmail.com>
David Siegel <david.siegel@artcom.de>
Sergey Kzyzhanovsky <skryzhanovsky@gmail.com>
Marco Rogers <marco.rogers@gmail.com>
Benjamin Fritsch <beanie@benle.de>
Jan Kassens <jan@kassens.net>
Robert Keizer <root@black.bluerack.ca>
Sam Shull <brickysam26@gmail.com>
Chandra Sekar S <chandru.in@gmail.com>
Andrew Naylor <argon@mkbot.net>
Benjamin Kramer <benny.kra@gmail.com>
Danny Coates <dannycoates@gmail.com>
Nick Stenning <nick@whiteink.com>
Bert Belder <bertbelder@gmail.com>
Trent Mick <trentm@gmail.com>
Fedor Indutny <fedor.indutny@gmail.com>
Illarionov Oleg <oleg@emby.ru>
Aria Stewart <aredridel@nbtsc.org>
Johan Euphrosine <proppy@aminche.com>
Russell Haering <russellhaering@gmail.com>
Bradley Meck <bradley.meck@gmail.com>
Tobie Langel <tobie.langel@gmail.com>
Tony Metzidis <tonym@tonym.us>
Mark Nottingham <mnot@mnot.net>
Sam Stephenson <sam@37signals.com>
Jorge Chamorro Bieling <jorge@jorgechamorro.com>
Evan Larkin <evan.larkin.il.com>
Sean Coates <sean@seancoates.com>
Tom Hughes <tom.hughes@palm.com>
Joshua Peek <josh@joshpeek.com>
Nathan Rajlich <nathan@tootallnate.net>
Peteris Krumins <peteris.krumins@gmail.com>
AJ ONeal <coolaj86@gmail.com>
Sami Samhuri <sami.samhuri@gmail.com>
Nikhil Marathe <nsm.nikhil@gmail.com>
Vitali Lovich <vitali.lovich@palm.com>
Stéphan Kochen <stephan@kochen.nl>
Oleg Efimov <efimovov@gmail.com>
Guillaume Tuton <guillaume@tuton.fr>
Tim Cooijmans <tim@aapopfiets.nl>
Dan Søndergaard <dan1990@gmail.com>
Silas Sewell <silas@sewell.ch>
Wade Simmons <wade@wades.im>
Daniel Gröber <darklord@darkboxed.org>
Travis Swicegood <development@domain51.com>
Oleg Slobodskoi <oleg008@gmail.com>
Jeremy Martin <jmar777@gmail.com>
Michael W <gcr@sneakygcr.net>
Sean Braithwaite <brapse@gmail.com>
Anders Conbere <aconbere@gmail.com>
Devin Torres <devin@devintorres.com>
Theo Schlossnagle <jesus@omniti.com>
Kai Chen <kaichenxyz@gmail.com>
Daniel C <333222@gmail.com>
Mihai Călin Bazon <mihai@bazon.net>
Ali Farhadi <a.farhadi@gmail.com>
Daniel Ennis <aikar@aikar.co>
Carter Allen <CarterA@opt-6.com>
Greg Hughes <greg@ghughes.com>
David Trejo <david.daniel.trejo@gmail.com>
Joe Walnes <joe@walnes.com>
Koichi Kobayashi <koichik@improvement.jp>
Daniel Gröber <dxld@darkboxed.org>
Konstantin Käfer <github@kkaefer.com>
Richard Rodger <richard@ricebridge.com>
Andreas Reich <andreas@reich.name>
Dean McNamee <dean@gmail.com>
Trevor Burnham <trevor@databraid.com>
Zachary Scott <zachary.s.scott@gmail.com>
Arnout Kazemier <info@3rd-Eden.com>
George Stagas <gstagas@gmail.com>
Scott McWhirter <scott.mcwhirter@joyent.com>
Jakub Lekstan <jakub.lekstan@dreamlab.pl>
Tim Baumann <tim@timbaumann.info>
Robert Mustacchi <rm@joyent.com>
George Miroshnykov <george.miroshnykov@gmail.com>
Marcel Laverdet <marcel@laverdet.com>
Alexandre Marangone <a.marangone@gmail.com>
Mark Cavage <mark.cavage@joyent.com>
Ryan Petrello <lists@ryanpetrello.com>
Siddharth Mahendraker <siddharth_mahen@hotmail.com>
Mathias Buus <m@ge.tt>
Yoshihiro KIKUCHI <yknetg@gmail.com>
Brett Kiefer <kiefer@gmail.com>
Mariano Iglesias <mariano@cricava.com>
Jörn Horstmann <git@jhorstmann.net>
Joe Shaw <joeshaw@litl.com>
Alex Xu <alex_y_xu@yahoo.ca>
Kip Gebhardt <kip.gebhardt@voxer.com>
Stefan Rusu <saltwaterc@gmail.com>
Wojciech Wnętrzak <w.wnetrzak@gmail.com>
Reid Burke <me@reidburke.com>
Vicente Jimenez Aguilar <googuy@gmail.com>
SAWADA Tadashi <cesare@mayverse.jp>
Logan Smyth <loganfsmyth@gmail.com>
Christopher Wright <christopherwright@gmail.com>
Mickaël Delahaye <mickael.delahaye@gmail.com>

97
CMakeLists.txt Normal file
View File

@@ -0,0 +1,97 @@
cmake_minimum_required(VERSION 2.6)
project(node)
if(USE_GCOV)
set(CMAKE_BUILD_TYPE "Debug")
# Set global c and c++ flags
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
# Link flags used for creating executables
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lgcov -fprofile-arcs")
# Link flags used for creating shared libraries
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -lgcov -profile-arcs")
endif()
#
# options
#
find_package(PythonInterp 2 REQUIRED)
option(SHARED_V8 "use system shared V8 library")
option(SHARED_LIBEV "use system shared libev library")
option(SHARED_CARES "use system shared c-ares library")
option(V8_SNAPSHOT "turn on snapshot when building stock v8")
option(V8_OPROFILE "Add oprofile support")
option(V8_GDBJIT "add gdbjit support")
option(DTRACE "build with DTrace (experimental)")
# cmake policies to get rid of some warnings
cmake_policy(SET CMP0009 NEW) # GLOB_RECURSE should no follow symlinks
# generic cmake configuration
include("cmake/configure.cmake")
# find and configure libs
include("cmake/libs.cmake")
# setup node build targets
include("cmake/node_build.cmake")
# setup v8 build targets
include("cmake/v8_build.cmake")
# docs
## might want to move this to doc/CMakeLists.txt
include("cmake/docs.cmake")
# tests
enable_testing()
include(CTest)
add_subdirectory("test/")
# package
include("cmake/package.cmake")
#
# Final build configuration output
#
message("** Build Summary **")
message(" Version: ${node_version_string}")
message(" Prefix: ${PREFIX}")
message(" Build Type: ${CMAKE_BUILD_TYPE}")
message(" Architecture: ${CMAKE_SYSTEM_PROCESSOR}")
message(" Platform: ${node_platform}")
if(SHARED_V8)
message(" V8: ${V8_LIBRARY_PATH}")
#else()
#message(" V8 jobs: ${parallel_jobs}")
endif()
if(SHARED_libev)
message(" libev: ${LIBEV_LIBRARY}")
endif()
if(SHARED_CARES)
message(" libc-ares: ${LIBCARES_LIBRARY}")
endif()
message(" RT library: ${RT}")
message(" DL library: ${DL}")
if(${OPENSSL_FOUND} MATCHES TRUE)
message(" OpenSSL: ${OPENSSL_LIBRARIES}")
endif()
if(USE_GCOV)
message(" gcov: enabled")
endif()
message(" CCFLAGS: ${CCFLAGS}")
message(" CPPFLAGS: ${CPPFLAGS}")

7
CTestConfig.cmake Normal file
View File

@@ -0,0 +1,7 @@
set(CTEST_PROJECT_NAME "node")
set(CTEST_NIGHTLY_START_TIME "00:00:00 EST")
set(CTEST_DROP_METHOD "http")
set(CTEST_DROP_SITE "my.cdash.org")
set(CTEST_DROP_LOCATION "/submit.php?project=node")
set(CTEST_DROP_SITE_CDASH TRUE)

1757
ChangeLog Normal file

File diff suppressed because it is too large Load Diff

80
LICENSE
View File

@@ -1,34 +1,8 @@
This license applies to all parts of Node that are not externally
maintained libraries. The externally maintained libraries used by Node
are:
- v8, located under deps/v8, which is copyrighted by the Google, Inc.
v8 has an MIT license.
- libev, located under deps/libev, and libeio, located at deps/libeio.
This code is copyrighted by Marc Alexander Lehmann. Both are dually
licensed under MIT and GPL2.
- JSMin JavaScript minifier, located at tools/jsmin.py. This code is
copyrighted by Douglas Crockford and Baruch Even and has an MIT license.
- parseUri, a URI parser, is located in src/http.js. This is just a small
snippit. It is copyrighted 2007 by Steven Levithan and released under an
MIT license.
- WAF build system, located at tools/waf. Copyrighted Thomas Nagy.
Released under an MIT license.
- The SCONS build system, located at tools/scons. Copyrighted by the SCONS
Foundation. Released under an MIT license.
Additionally deps/http_parser is based on Zed Shaw's Mongrel. Mongrel is
copyrighted by Zed Shaw and distributed under GPL2 or a permissive open
licence. See deps/http_parser/LICENCE for more information.
Node's license follows:
Copyright 2009, Ryan Lienhart Dahl. All rights reserved.
====
Copyright Joyent, Inc. and other Node contributors. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
@@ -45,4 +19,50 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
IN THE SOFTWARE.
====
This license applies to all parts of Node that are not externally
maintained libraries.
The externally maintained libraries used by Node are:
- v8, located at deps/v8. v8 is copyright Google, Inc, and released
under a BSD license.
- libev, located at deps/libev, and libeio, located at deps/libeio. libev
and libeio are copyright Marc Alexander Lehmann, and dual-licensed
under the MIT license and GPL2.
- WAF build system, located at tools/waf. WAF is copyright Thomas Nagy,
and released under the MIT license.
- The SCONS build system, located at tools/scons. SCONS is copyright
the SCONS Foundation and released under the MIT license.
- C-Ares, an asynchronous DNS client, located at deps/c-ares. C-Ares is
copyright the Massachusetts Institute of Technology, authored by
Greg Hudson, Daniel Stenberg and others, and released under the MIT
license.
- Node, optionally, dynamically links to OpenSSL, cryptographic software
written by Eric Young (eay@cryptsoft.com) to provide SSL/TLS encryption.
OpenSSL is copyright The OpenSSL Project and released under the OpenSSL
license. OpenSSL is not included in the Node distribution.
See http://openssl.org/ for more information.
- tools/doctool/markdown.js is copyright 2009-2010 Dominic Baggott and Ash
Berli and released under the MIT license.
- HTTP Parser, located at deps/http_parser, is a small C library
copyright Ryan Lienhart Dahl and released under the MIT license.
- src/platform_darwin_proctitle.cc, has code taken from the Chromium
project copyright Google Inc. and released under a BSD license.
- tools/closure_linter is copyright The Closure Linter Authors and
Google Inc. and released under the Apache License, version 2.0.
- tools/cpplint.py is copyright Google Inc. and released under a
BSD license.

142
Makefile Normal file
View File

@@ -0,0 +1,142 @@
WAF=python tools/waf-light
web_root = node@nodejs.org:~/web/nodejs.org/
all: program
all-progress:
@$(WAF) -p build
program:
@$(WAF) --product-type=program build
staticlib:
@$(WAF) --product-type=cstaticlib build
dynamiclib:
@$(WAF) --product-type=cshlib build
install:
@$(WAF) install
uninstall:
@$(WAF) uninstall
test: all
python tools/test.py --mode=release simple message
test-valgrind: all
python tools/test.py --mode=release --valgrind simple message
test-all: all
python tools/test.py --mode=debug,release
test-all-valgrind: all
python tools/test.py --mode=debug,release --valgrind
test-release: all
python tools/test.py --mode=release
test-debug: all
python tools/test.py --mode=debug
test-message: all
python tools/test.py message
test-simple: all
python tools/test.py simple
test-pummel: all
python tools/test.py pummel
test-internet: all
python tools/test.py internet
build/default/node: all
apidoc_sources = $(wildcard doc/api/*.markdown)
apidocs = $(addprefix build/,$(apidoc_sources:.markdown=.html))
apidoc_dirs = build/doc build/doc/api/ build/doc/api/assets
apiassets = $(subst api_assets,api/assets,$(addprefix build/,$(wildcard doc/api_assets/*)))
website_files = \
build/doc/index.html \
build/doc/v0.4_announcement.html \
build/doc/cla.html \
build/doc/sh_main.js \
build/doc/sh_javascript.min.js \
build/doc/sh_vim-dark.css \
build/doc/logo.png \
build/doc/sponsored.png \
build/doc/favicon.ico \
build/doc/pipe.css
doc: build/default/node $(apidoc_dirs) $(website_files) $(apiassets) $(apidocs)
$(apidoc_dirs):
mkdir -p $@
build/doc/api/assets/%: doc/api_assets/% build/doc/api/assets/
cp $< $@
build/doc/%: doc/%
cp $< $@
build/doc/api/%.html: doc/api/%.markdown build/default/node $(apidoc_dirs) $(apiassets) tools/doctool/doctool.js
build/default/node tools/doctool/doctool.js doc/template.html $< > $@
build/doc/%:
website-upload: doc
scp -r build/doc/* $(web_root)
docopen: build/doc/api/all.html
-google-chrome build/doc/api/all.html
docclean:
-rm -rf build/doc
clean:
$(WAF) clean
-find tools -name "*.pyc" | xargs rm -f
distclean: docclean
-find tools -name "*.pyc" | xargs rm -f
-rm -rf build/ node node_g
check:
@tools/waf-light check
VERSION=$(shell git describe)
TARNAME=node-$(VERSION)
#dist: doc/node.1 doc/api
dist: doc
git archive --format=tar --prefix=$(TARNAME)/ HEAD | tar xf -
mkdir -p $(TARNAME)/doc
cp doc/node.1 $(TARNAME)/doc/node.1
cp -r build/doc/api $(TARNAME)/doc/api
rm -rf $(TARNAME)/deps/v8/test # too big
tar -cf $(TARNAME).tar $(TARNAME)
rm -rf $(TARNAME)
gzip -f -9 $(TARNAME).tar
bench:
benchmark/http_simple_bench.sh
bench-idle:
./node benchmark/idle_server.js &
sleep 1
./node benchmark/idle_clients.js &
jslint:
PYTHONPATH=tools/closure_linter/ python tools/closure_linter/closure_linter/gjslint.py --unix_mode --strict --nojsdoc -r lib/ -r src/ -r test/
cpplint:
@python tools/cpplint.py $(wildcard src/*.cc src/*.h src/*.c)
lint: jslint cpplint
.PHONY: lint cpplint jslint bench clean docopen docclean doc dist distclean check uninstall install all program staticlib dynamiclib test test-all website-upload

40
Makefile.cmake Normal file
View File

@@ -0,0 +1,40 @@
BUILD?=build
VERBOSE?=0
PARALLEL_JOBS?=1
CMAKE?=cmake
TOOLCHAIN_FILE=#./cmake/codesourcery-arm-toolchain.cmake
all: package
$(BUILD)/Makefile:
mkdir $(BUILD) || exit 0
cd $(BUILD) && $(CMAKE) -DCMAKE_VERBOSE_MAKEFILE=$(VERBOSE) -DCMAKE_TOOLCHAIN_FILE=$(TOOLCHAIN_FILE) ..
build: $(BUILD)/Makefile
cd $(BUILD) && make -j $(PARALLEL_JOBS)
install: build
cd $(BUILD) && sudo make install
clean:
rm -rf $(BUILD)
doc: $(BUILD)/Makefile
cd $(BUILD) && make doc
package: $(BUILD)/Makefile
cd $(BUILD) && make package
test: $(BUILD)/Makefile
cd $(BUILD) && make test
cdash: $(BUILD)/Makefile
cd $(BUILD) && make Experimental
cdash-cov: $(BUILD)/Makefile
cd $(BUILD) && $(CMAKE) -DUSE_GCOV=True .. && make Experimental
cdash-mem: $(BUILD)/Makefile
cd $(BUILD) && make NightlyMemoryCheck
.PHONY: build install clean doc package test cdash cdash-cov cdash-mem

12
README
View File

@@ -1,12 +0,0 @@
Purely evented I/O for V8 javascript.
See http://tinyclouds.org/node for more information.
For help and discussion subscribe to the mailing list at
http://groups.google.com/group/nodejs or send an email to
nodejs+subscribe@googlegroups.com.
To build
./configure
make
make install

77
README.cmake Normal file
View File

@@ -0,0 +1,77 @@
Instructions for building with cmake
Make sure you have cmake:
Ubuntu/Debian: sudo apt-get install cmake
Mac: http://www.cmake.org/files/v2.8/cmake-2.8.3-Darwin-universal.dmg
Other platforms: http://www.cmake.org/cmake/resources/software.html
To build:
make -f Makefile.cmake
make -f Makefile.cmake install
To run the tests:
make -f Makefile.cmake test
To build the documentation:
make -f Makefile.cmake doc
To read the documentation:
man doc/node.1
To build distro packages (tgz, deb, rpm, PackageMaker):
make -f Makefile.cmake package
To submit test results (see http://my.cdash.org/index.php?project=node):
make -f Makefile.cmake cdash
To submit coverage test results:
make -f Makefile.cmake cdash-cov
To submit valgrind test results:
make -f Makefile.cmake cdash-mem
Cross-compiling:
An example toolchain file for the CodeSourcery ARM toolchain is included in
the cmake directory: codesourcery-arm-toolchain.cmake.
Install the CodeSourcery toolchain, set the path to the toolchain in
cmake/codesourcery-arm-toolchain.cmake, and uncomment the TOOLCHAIN_FILE
variable in Makefile.cmake to use it.
If you are using cmake directly, just add the flag
"-DCMAKE_TOOLCHAIN_FILE=/path/to/toolchain-file" when
running cmake.
Using cmake directly:
cd ~/your-node-source-dir
mkdir name-of-build-dir (can be anything)
cd name-of-build-dir
cmake ..
At this point you have generated a set of Makefiles and can use the standard
make commands (make, make install, etc.). The Makefile.cmake file is just a
wrapper around these commands; take a look at it for more details.
Other build targets:
make Experimental
make Nightly
make NightlyMemoryCheck
make Continuous
Additional options:
In the CMakeLists.txt, you'll see things like
option(SHARED_V8, ...). If you want to enable any of those options you can
pass "-DOPTION=True" when running cmake (e.g., cmake -DSHARED_V8=True).
See http://nodejs.org/ for more information. For help and discussion
subscribe to the mailing list by visiting
http://groups.google.com/group/nodejs or by sending an email to
nodejs+subscribe@googlegroups.com.

33
README.md Normal file
View File

@@ -0,0 +1,33 @@
Evented I/O for V8 javascript.
===
To build:
./configure
make
make install
To run the tests:
make test
To build the documentation:
make doc
To read the documentation:
man doc/node.1
Resources for Newcomers
---
- [The Wiki](http://github.com/ry/node/wiki)
- [nodejs.org](http://nodejs.org/)
- [how to install node.js and npm (node package manager)](http://joyeur.com/2010/12/10/installing-node-and-npm/)
- [list of modules](http://github.com/ry/node/wiki/modules)
- [list of companies and projects using node](http://github.com/ry/node/wiki)
- [node.js mailing list](http://groups.google.com/group/nodejs)
- irc chatroom, [#node.js on freenode.net](http://webchat.freenode.net?channels=node.js&uio=d4)
- [community](https://github.com/ry/node/wiki/Community)
- [contributing](https://github.com/ry/node/wiki/Contributing)
- [big list of all the helpful wiki pages](https://github.com/ry/node/wiki/_pages)

46
TODO
View File

@@ -1,21 +1,33 @@
Major features planned: (somewhat ordered)
- fix tests for NODE_MODULE_CONTEXTS=1
- readline
- fix for two column glyphs. use Markus Kuhn's wcwidth.c
- fix for commands that extend beyond term width
- Erradicate all traces of 'binary' encoding. Only used, now, in OpenSSL
binding.
- EventSource branch merged
- Use C++ style casts everywhere.
- Ruby-like Process#detach (is that possible?)
- stderr isn't flushing on exit
- ReadStream should not use an offset in calls to fs.read
(so that it can pull in files larger than 2G)
- process object should be defined in src/node.js not in c++
- Test for EMFILE accept spin bug.
- Deprecate setEncoding() and instead add option to on('data').
Example:
- C++ API for external modules/plugins
(Some sort of module build system?)
stdin.on('data', { encoding: 'utf8' }, function (chunk) {
process.stdout.write('WRITE: ' + chunk);
});
- Posgres module
(http://www.postgresql.org/docs/8.1/static/libpq-async.html)
Perhaps by assigning cb.opts.encoding and calling
EventEmitter.optHandlers.encoding() if it exists.
- Support AF_UNIX named pipes
- DOCS
- anchor links next to each function, for easy linking.
EG <a href="#fs.stat">#</a>
- Signal handlers
- Internally replace getaddrinfo() with udns
http://www.corpit.ru/mjt/udns.html
JS resolver interface
- TLS
- UDP interface
- Socket pairs
- "node --raw-js script.js" should bipass all Node code and load a raw V8
interpreter
- Use http_parser_execute2() in node_http_parser.cc and make req.pause()
work correctly
https://github.com/ry/http-parser/blob/c95a5479596e95b7cdd88ca9d7b32fd3afb4379c/http_parser.h#L266

88
TODO.win32 Normal file
View File

@@ -0,0 +1,88 @@
- Implement setenv / unsetenv
- Implement other stuff missing in node.cc/process
Like getuid, getgid, setgid, kill etc.
- Better `net` support
* getaddrinfo
* setMulticastTTL, setMembership, setLoopback
* pipe, socketpair
* A named pipe should be provided when a unix socket is requested.
* SendMsg and RecvMsg should be supported with named pipes.
- New libev backend
The current libev backend supports sockets only. This complicates stuff like
child processes, stdio. Best would be if node_net switched from exposing
readyness notifications to using completion notifications, so on windows we
could use IOCP for sockets. Experts tell me that is really the fastest way
to work with sockets on windows.
- Child process issues
* Communication between parent and child is slow; it uses a socketpair
where a pipe would be much faster. Replace it by a pipe when there
is a libev backend that supports waiting for a pipe.
* When a child process spawns the pid is not available straightaway.
On linux the pid is available immediately because fork() doesn't
block; on windows a libeio thread is used to call CreateProcess.
So this can't really be fixed, but it could be worked around by adding a
'spawn' or 'pid' event.
* passing socket custom_fds is not supported
* child_process.exec() only works on systems with msys installed.
It's because it relies on the 'sh' shell. The default windows shell
is 'cmd' and it works a little differently. Maybe add an option to
specify the shell to exec()?
- Make colorful util.inspect work on windows.
- Stdio: support passing sockets between master/child process
Normal windows applications wouldn't like this, but it can be useful for
communication between node processes. This requires
stdio.isStdinBlocking/isStdoutBlocking to be smarter.
- Skip/fix tests that can never pass on windows
- Find a solution for fs.symlink / fs.lstat / fs.chown
Windows has different symlink types: file symlinks (vista+),
directory symlinks (vista+), junction points (xp+)
- Handle _open_osfhandle failures
E.g. currently we're using the construct _open_osfhandle(socket/open/accept(...)).
Now socket() can fail by itself and _open_osfhandle can fail by itself too.
If socket() fails it returns -1 so _open_osfhandle fails as well, but and we'll always return/throw EBADF.
If _open_osfhandle fails but socket doesn't, a stray handle is left open. It should be fixed.
- Think about `make install`
- Extensions
Should be DLLs on windows.
- Link pthreads-w32 statically by default
- Link Mingw libraries statically by default
Like libstdc++.dll, more maybe.
Microsoft libs are always there, no static linkage required (e.g. msvcrt, winsock2).
- Make (open?)SSL work
- Support using shared libs (libeio, v8, c-ares)
Need to link with with a stub library. Libraries should use `dllexport`,
headers must have `dllimport`.
- V8: push MINGW32 build fixes upstream
- Work around missing pread/pwrite more elegantly
Currently it's exported from libeio, while it wasn't intended to be exported.
The libeio workaround implementation sucks, it uses a global mutex.
It should be possible to implement pread and pwrite using winapi's ReadFile/Writefile
directly, passing an OVERLAPPED structure while not associating with an completion port.
- Work around missing inet_pton/inet_ntop more elegantly
Currently it's exported from from c-ares, while it wasn't intended to be exported.
It prevents linking c-ares dynamically.
- See what libev/libeio changes can be pushed upstream
- 64-bit build
Should be possible with MinGW-w64, it's pretty good.
- ... much more probably

View File

@@ -0,0 +1,6 @@
SlowBuffer = require('buffer').SlowBuffer;
for (var i = 0; i < 1e6; i++) {
b = new SlowBuffer(10);
b[1] = 2
}

42
benchmark/fast_buffer2.js Normal file
View File

@@ -0,0 +1,42 @@
var SlowBuffer = require('buffer').SlowBuffer;
var POOLSIZE = 8*1024;
var pool;
function allocPool () {
pool = new SlowBuffer(POOLSIZE);
pool.used = 0;
}
function FastBuffer (length) {
this.length = length;
if (length > POOLSIZE) {
// Big buffer, just alloc one.
this.parent = new Buffer(length);
this.offset = 0;
} else {
// Small buffer.
if (!pool || pool.length - pool.used < length) allocPool();
this.parent = pool;
this.offset = pool.used;
pool.used += length;
}
// HERE HERE HERE
SlowBuffer.makeFastBuffer(this.parent, this, this.offset, this.length);
}
exports.FastBuffer = FastBuffer;
FastBuffer.prototype.get = function (i) {
if (i < 0 || i >= this.length) throw new Error("oob");
return this.parent[this.offset + i];
};
FastBuffer.prototype.set = function (i, v) {
if (i < 0 || i >= this.length) throw new Error("oob");
return this.parent[this.offset + i] = v;
};
// TODO define slice, toString, write, etc.
// slice should not use c++

View File

@@ -0,0 +1,6 @@
FastBuffer = require('./fast_buffer2').FastBuffer;
for (var i = 0; i < 1e6; i++) {
b = new FastBuffer(10);
b[1] = 2;
}

View File

@@ -0,0 +1,4 @@
for (var i = 0; i < 1e6; i++) {
b = new Buffer(10);
b[1] = 2;
}

View File

@@ -0,0 +1,43 @@
var binding = require('./build/default/binding');
c = 0
function js() {
return c++; //(new Date()).getTime();
}
var cxx = binding.hello;
var i, N = 100000000;
console.log(js());
console.log(cxx());
var start = new Date();
for (i = 0; i < N; i++) {
js();
}
var jsDiff = new Date() - start;
console.log(N +" JS function calls: " + jsDiff);
var start = new Date();
for (i = 0; i < N; i++) {
cxx();
}
var cxxDiff = new Date() - start;
console.log(N +" C++ function calls: " + cxxDiff);
function toMicro (diff) {
return (diff / N) * 1000000;
}
console.log("\nJS function call speed: %d microseconds", toMicro(jsDiff));
console.log("C++ function call speed: %d microseconds", toMicro(cxxDiff));
console.log("\nJS speedup " + (cxxDiff / jsDiff));

View File

@@ -0,0 +1,19 @@
#include <v8.h>
#include <node.h>
#include <time.h>
using namespace v8;
static int c = 0;
static Handle<Value> Hello(const Arguments& args) {
HandleScope scope;
//time_t tv = time(NULL);
return scope.Close(Integer::New(c++));
}
extern "C" void init (Handle<Object> target) {
HandleScope scope;
//target->Set(String::New("hello"), String::New("World"));
NODE_SET_METHOD(target, "hello", Hello);
}

View File

@@ -0,0 +1,15 @@
srcdir = '.'
blddir = 'build'
VERSION = '0.0.1'
def set_options(opt):
opt.tool_options('compiler_cxx')
def configure(conf):
conf.check_tool('compiler_cxx')
conf.check_tool('node_addon')
def build(bld):
obj = bld.new_task_gen('cxx', 'shlib', 'node_addon')
obj.target = 'binding'
obj.source = 'binding.cc'

View File

@@ -1,23 +1,33 @@
path = require("path");
exec = require("child_process").exec;
http = require("http");
port = parseInt(process.env.PORT || 8000);
console.log('pid ' + process.pid);
fixed = ""
for (var i = 0; i < 20*1024; i++) {
fixed += "C";
}
stored = {};
new node.http.Server(function (req, res) {
var commands = req.uri.path.split("/");
storedBuffer = {};
var server = http.createServer(function (req, res) {
var commands = req.url.split("/");
var command = commands[1];
var body = "";
var arg = commands[2];
var n_chunks = parseInt(commands[3], 10);
var status = 200;
//p(req.headers);
if (command == "bytes") {
var n = parseInt(arg, 10)
if (n <= 0)
throw "bytes called with n <= 0"
throw "bytes called with n <= 0"
if (stored[n] === undefined) {
puts("create stored[n]");
console.log("create stored[n]");
stored[n] = "";
for (var i = 0; i < n; i++) {
stored[n] += "C"
@@ -25,6 +35,18 @@ new node.http.Server(function (req, res) {
}
body = stored[n];
} else if (command == "buffer") {
var n = parseInt(arg, 10)
if (n <= 0) throw new Error("bytes called with n <= 0");
if (storedBuffer[n] === undefined) {
console.log("create storedBuffer[n]");
storedBuffer[n] = new Buffer(n);
for (var i = 0; i < n; i++) {
storedBuffer[n][i] = "C".charCodeAt(0);
}
}
body = storedBuffer[n];
} else if (command == "quit") {
res.connection.server.close();
body = "quitting";
@@ -37,14 +59,34 @@ new node.http.Server(function (req, res) {
body = "not found\n";
}
var content_length = body.length.toString();
// example: http://localhost:port/bytes/512/4
// sends a 512 byte body in 4 chunks of 128 bytes
if (n_chunks > 0) {
res.writeHead(status, { "Content-Type": "text/plain",
"Transfer-Encoding": "chunked" });
// send body in chunks
var len = body.length;
var step = ~~(len / n_chunks) || len;
res.sendHeader( status
, [ ["Content-Type", "text/plain"]
, ["Content-Length", content_length]
]
);
res.sendBody(body);
res.finish();
}).listen(8000);
for (var i = 0; i < len; i += step) {
res.write(body.slice(i, i + step));
}
res.end();
} else {
var content_length = body.length.toString();
res.writeHead(status, { "Content-Type": "text/plain",
"Content-Length": content_length });
res.end(body);
}
});
server.listen(port, function () {
console.log('Listening at http://127.0.0.1:'+port+'/');
});
process.on('exit', function() {
console.error('libuv counters', process.uvCounters());
});

View File

@@ -7,45 +7,45 @@ end
def wait(seconds)
n = (seconds / 0.01).to_i
n.times do
n.times do
sleep(0.01)
#File.read(DIR + '/yahoo.html')
#File.read(DIR + '/yahoo.html')
end
end
class SimpleApp
@@responses = {}
def initialize
@count = 0
end
def deferred?(env)
false
end
def call(env)
path = env['PATH_INFO'] || env['REQUEST_URI']
commands = path.split('/')
@count += 1
if commands.include?('periodical_activity') and @count % 10 != 1
return [200, {'Content-Type'=>'text/plain'}, "quick response!\r\n"]
end
if commands.include?('fibonacci')
n = commands.last.to_i
raise "fibonacci called with n <= 0" if n <= 0
body = (1..n).to_a.map { |i| fib(i).to_s }.join(' ')
status = 200
elsif commands.include?('wait')
n = commands.last.to_f
raise "wait called with n <= 0" if n <= 0
wait(n)
body = "waited about #{n} seconds"
status = 200
elsif commands.include?('bytes')
n = commands.last.to_i
raise "bytes called with n <= 0" if n <= 0
@@ -56,17 +56,17 @@ class SimpleApp
n = 20 * 1024;
body = @@responses[n] || "C"*n
status = 200
elsif commands.include?('test_post_length')
input_body = ""
while chunk = env['rack.input'].read(512)
input_body << chunk
input_body << chunk
end
if env['CONTENT_LENGTH'].to_i == input_body.length
body = "Content-Length matches input length"
status = 200
else
body = "Content-Length doesn't matches input length!
body = "Content-Length doesn't matches input length!
content_length = #{env['CONTENT_LENGTH'].to_i}
input_body.length = #{input_body.length}"
status = 500
@@ -75,7 +75,7 @@ class SimpleApp
status = 404
body = "Undefined url"
end
body += "\r\n"
headers = {'Content-Type' => 'text/plain', 'Content-Length' => body.length.to_s }
[status, headers, [body]]
@@ -90,6 +90,6 @@ if $0 == __FILE__
require 'thin'
require 'ebb'
# Rack::Handler::Mongrel.run(SimpleApp.new, :Port => 8000)
Thin::Server.start("0.0.0.0", 8000, SimpleApp.new)
Thin::Server.start("0.0.0.0", 8000, SimpleApp.new)
# Ebb::start_server(SimpleApp.new, :port => 8000)
end

77
benchmark/http_simple_bench.sh Executable file
View File

@@ -0,0 +1,77 @@
#!/bin/bash
SERVER=127.0.0.1
PORT=8000
# You may want to configure your TCP settings to make many ports available
# to node and ab. On macintosh use:
# sudo sysctl -w net.inet.ip.portrange.first=32768
# sudo sysctl -w net.inet.tcp.msl=1000
if [ ! -d benchmark/ ]; then
echo "Run this script from the node root directory"
exit 1
fi
if [ $SERVER == "127.0.0.1" ]; then
./node benchmark/http_simple.js &
node_pid=$!
sleep 1
fi
info=`curl -s http://$SERVER:$PORT/info`
eval $info
date=`date "+%Y%m%d%H%M%S"`
ab_hello_world() {
local type="$1"
local ressize="$2"
if [ $type == "string" ]; then
local uri="bytes/$ressize"
else
local uri="buffer/$ressize"
fi
name="ab-hello-world-$type-$ressize"
dir=".benchmark_reports/$name/$rev/"
if [ ! -d $dir ]; then
mkdir -p $dir
fi
summary_fn="$dir/$date.summary"
data_fn="$dir/$date.data"
echo "Bench $name starts in 3 seconds..."
# let shit calm down
sleep 3
# hammer that as hard as it can for 10 seconds.
ab -g $data_fn -c 100 -t 10 http://$SERVER:$PORT/$uri > $summary_fn
# add our data about the server
echo >> $summary_fn
echo >> $summary_fn
echo "webserver-rev: $rev" >> $summary_fn
echo "webserver-uname: $uname" >> $summary_fn
grep Req $summary_fn
echo "Summary: $summary_fn"
echo
}
# 1k
ab_hello_world 'string' '1024'
ab_hello_world 'buffer' '1024'
# 100k
ab_hello_world 'string' '102400'
ab_hello_world 'buffer' '102400'
if [ ! -z $node_pid ]; then
kill -9 $node_pid
fi

49
benchmark/idle_clients.js Normal file
View File

@@ -0,0 +1,49 @@
net = require('net');
var errors = 0, connections = 0;
var lastClose = 0;
function connect () {
process.nextTick(function () {
var s = net.Stream();
var gotConnected = false;
s.connect(9000);
s.on('connect', function () {
gotConnected = true;
connections++;
connect();
});
s.on('close', function () {
if (gotConnected) connections--;
lastClose = new Date();
});
s.on('error', function () {
errors++;
});
});
}
connect();
var oldConnections, oldErrors;
// Try to start new connections every so often
setInterval(connect, 5000);
setInterval(function () {
if (oldConnections != connections) {
oldConnections = connections;
console.log("CLIENT %d connections: %d", process.pid, connections);
}
if (oldErrors != errors) {
oldErrors = errors;
console.log("CLIENT %d errors: %d", process.pid, errors);
}
}, 1000);

31
benchmark/idle_server.js Normal file
View File

@@ -0,0 +1,31 @@
net = require('net');
connections = 0;
var errors = 0;
server = net.Server(function (socket) {
socket.on('error', function () {
errors++;
});
});
//server.maxConnections = 128;
server.listen(9000);
var oldConnections, oldErrors;
setInterval(function () {
if (oldConnections != server.connections) {
oldConnections = server.connections;
console.log("SERVER %d connections: %d", process.pid, server.connections);
}
if (oldErrors != errors) {
oldErrors = errors;
console.log("SERVER %d errors: %d", process.pid, errors);
}
}, 1000);

110
benchmark/io.c Normal file
View File

@@ -0,0 +1,110 @@
/**
* gcc -o iotest io.c
*/
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
#include <sys/time.h>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
int tsize = 1000 * 1048576;
const char *path = "/tmp/wt.dat";
int c = 0;
char* bufit(size_t l)
{
char *p = malloc(l);
memset(p, '!', l);
return p;
}
void writetest(int size, size_t bsize)
{
int i;
char *buf = bufit(bsize);
struct timeval start, end;
double elapsed;
double mbps;
int fd = open(path, O_CREAT|O_WRONLY, 0644);
if (fd < 0) {
perror("open failed");
exit(254);
}
assert(0 == gettimeofday(&start, NULL));
for (i = 0; i < size; i += bsize) {
int rv = write(fd, buf, bsize);
if (c++ % 2000 == 0) fprintf(stderr, ".");
if (rv < 0) {
perror("write failed");
exit(254);
}
}
#ifdef __linux__
fdatasync(fd);
#else
fsync(fd);
#endif
close(fd);
assert(0 == gettimeofday(&end, NULL));
elapsed = (end.tv_sec - start.tv_sec) + ((double)(end.tv_usec - start.tv_usec))/100000.;
mbps = ((tsize/elapsed)) / 1048576;
fprintf(stderr, "\nWrote %d bytes in %03fs using %ld byte buffers: %03fmB/s\n", size, elapsed, bsize, mbps);
free(buf);
}
void readtest(int size, size_t bsize)
{
int i;
char *buf = bufit(bsize);
struct timeval start, end;
double elapsed;
double mbps;
int fd = open(path, O_RDONLY, 0644);
if (fd < 0) {
perror("open failed");
exit(254);
}
assert(0 == gettimeofday(&start, NULL));
for (i = 0; i < size; i += bsize) {
int rv = read(fd, buf, bsize);
if (rv < 0) {
perror("write failed");
exit(254);
}
}
close(fd);
assert(0 == gettimeofday(&end, NULL));
elapsed = (end.tv_sec - start.tv_sec) + ((double)(end.tv_usec - start.tv_usec))/100000.;
mbps = ((tsize/elapsed)) / 1048576;
fprintf(stderr, "Read %d bytes in %03fs using %ld byte buffers: %03fmB/s\n", size, elapsed, bsize, mbps);
free(buf);
}
void cleanup() {
unlink(path);
}
int main()
{
int i;
int bsizes[] = {1024, 4096, 8192, 16384, 32768, 65536, 0};
for (i = 0; bsizes[i] != 0; i++) {
writetest(tsize, bsizes[i]);
}
for (i = 0; bsizes[i] != 0; i++) {
readtest(tsize, bsizes[i]);
}
atexit(cleanup);
return 0;
}

109
benchmark/io.js Normal file
View File

@@ -0,0 +1,109 @@
var fs = require('fs');
var util = require('util');
var Buffer = require('buffer').Buffer;
var path = "/tmp/wt.dat";
var tsize = 1000 * 1048576;
var bsizes = [1024, 4096, 8192, 16384, 32768, 65536];
function bufit(size) {
var buf = new Buffer(size);
for (var i = 0; i <buf.length ; i += 1) {
buf[i] = 33;
}
return buf;
}
function once(emitter, name, cb) {
function incb() {
cb.apply(undefined, arguments);
emitter.removeListener(name, incb);
}
emitter.addListener(name, incb);
}
c = 0
function writetest(size, bsize) {
var s = fs.createWriteStream(path, {'flags': 'w', 'mode': 0644});
var remaining = size;
var buf = bufit(bsize);
function dowrite() {
var rv = s.write(buf);
remaining -= buf.length;
if (remaining > 0) {
//if (remaining % 90000 == 0) console.error("remaining: %d", remaining);
//process.nextTick(dowrite);
} else {
s.emit('done')
s.end();
}
}
s.on('drain', function () {
dowrite();
if (c++ % 2000 == 0) util.print(".");
});
dowrite();
return s;
}
function readtest(size, bsize) {
var s = fs.createReadStream(path, {'flags': 'r', 'encoding': 'binary', 'mode': 0644, 'bufferSize': bsize});
s.addListener("data", function (chunk) {
// got a chunk...
});
return s;
}
function wt(tsize, bsize, done) {
var start = Date.now();
s = writetest(tsize, bsizes[0]);
s.addListener('close', function() {
var end = Date.now();
var diff = end - start;
console.log('Wrote '+ tsize +' bytes in '+ diff/1000 +'s using '+ bsize +' byte buffers: '+ ((tsize/(diff/1000)) / 1048576) +' mB/s');
done();
});
}
function rt(tsize, bsize, done) {
var start = Date.now();
s = readtest(tsize, bsizes[0]);
s.addListener('close', function() {
var end = Date.now();
var diff = end - start;
console.log('Read '+ tsize +' bytes in '+ diff/1000 +'s using '+ bsize +' byte buffers: '+ ((tsize/(diff/1000)) / 1048576) +' mB/s');
done();
});
}
var bs= 0;
function nextwt() {
if (bsizes.length <= bs) {
bs = 0;
nextrt();
return;
}
wt(tsize, bsizes[bs], nextwt);
bs += 1;
}
function nextrt() {
if (bsizes.length <= bs) {
fs.unlink(path, function (err) {
if (err) throw err;
console.log('All done!');
});
return;
}
rt(tsize, bsizes[bs], nextrt);
bs += 1;
}
nextwt();

86
benchmark/plot.R Executable file
View File

@@ -0,0 +1,86 @@
#!/usr/bin/env Rscript
# To use this script you'll need to install R: http://www.r-project.org/
# and a library for R called ggplot2
# Which can be done by starting R and typing install.packages("ggplot2")
# like this:
#
# shell% R
# R version 2.11.0 beta (2010-04-12 r51689)
# > install.packages("ggplot2")
# (follow prompt)
#
# Then you can try this script by providing a full path to .data file
# outputed from 'make bench'
#
# > cd ~/src/node
# > make bench
# ...
# > ./benchmark/plot.R .benchmark_reports/ab-hello-world-buffer-1024/ff456b38862de3fd0118c6ac6b3f46edb1fbb87f/20101013162056.data
#
# This will generate a PNG file which you can view
#
#
# Hopefully these steps will be automated in the future.
library(ggplot2)
args <- commandArgs(TRUE)
ab.load <- function (filename, name) {
raw <- data.frame(read.csv(filename, sep="\t", header=T), server=name)
raw <- data.frame(raw, time=raw$seconds-min(raw$seconds))
raw <- data.frame(raw, time_s=raw$time/1000000)
raw
}
#ab.tsPoint <- function (d) {
# qplot(time_s, ttime, data=d, facets=server~.,
# geom="point", alpha=I(1/15), ylab="response time (ms)",
# xlab="time (s)", main="c=30, res=26kb",
# ylim=c(0,100))
#}
#
#ab.tsLine <- function (d) {
# qplot(time_s, ttime, data=d, facets=server~.,
# geom="line", ylab="response time (ms)",
# xlab="time (s)", main="c=30, res=26kb",
# ylim=c(0,100))
#}
filename <- args[0:1]
data <- ab.load(filename, "node")
# histogram
#hist_png_filename <- gsub(".data", "_hist.png", filename)
hist_png_filename <- "hist.png"
png(filename = hist_png_filename, width = 480, height = 380, units = "px")
qplot(ttime, data=data, geom="histogram",
main="xxx",
binwidth=1, xlab="response time (ms)",
xlim=c(0,100))
print(hist_png_filename)
# time series
#ts_png_filename <- gsub(".data", "_ts.png", filename)
ts_png_filename = "ts.png"
png(filename = ts_png_filename, width = 480, height = 380, units = "px")
qplot(time, ttime, data=data, facets=server~.,
geom="point", alpha=I(1/15), ylab="response time (ms)",
xlab="time (s)", main="xxx",
ylim=c(0,100))
print(ts_png_filename)

19
benchmark/process_loop.js Normal file
View File

@@ -0,0 +1,19 @@
var util = require("util"),
childProcess = require("child_process");
function next (i) {
if (i <= 0) return;
var child = childProcess.spawn("echo", ["hello"]);
child.stdout.addListener("data", function (chunk) {
util.print(chunk);
});
child.addListener("exit", function (code) {
if (code != 0) process.exit(-1);
next(i - 1);
});
}
next(500);

View File

@@ -0,0 +1 @@
console.log(process.memoryUsage().rss);

31
benchmark/run.js Normal file
View File

@@ -0,0 +1,31 @@
var path = require("path");
var util = require("util");
var childProcess = require("child_process");
var benchmarks = [ "timers.js"
, "process_loop.js"
, "static_http_server.js"
];
var benchmarkDir = path.dirname(__filename);
function exec (script, callback) {
var start = new Date();
var child = childProcess.spawn(process.argv[0], [path.join(benchmarkDir, script)]);
child.addListener("exit", function (code) {
var elapsed = new Date() - start;
callback(elapsed, code);
});
}
function runNext (i) {
if (i >= benchmarks.length) return;
util.print(benchmarks[i] + ": ");
exec(benchmarks[i], function (elapsed, code) {
if (code != 0) {
console.log("ERROR ");
}
console.log(elapsed);
runNext(i+1);
});
};
runNext(0);

15
benchmark/settimeout.js Normal file
View File

@@ -0,0 +1,15 @@
console.log("wait...");
var done = 0;
var N = 5000000;
var begin = new Date();
for (var i = 0; i < N; i++) {
setTimeout(function () {
if (++done == N) {
var end = new Date();
console.log("smaller is better");
console.log("startup: %d", start - begin);
console.log("done: %d", end - start);
}
}, 1000);
}
var start = new Date();

26
benchmark/startup.js Normal file
View File

@@ -0,0 +1,26 @@
var spawn = require('child_process').spawn,
path = require('path'),
emptyJsFile = path.join(__dirname, '../test/fixtures/semicolon.js'),
starts = 100,
i = 0,
start;
function startNode() {
var node = spawn(process.execPath || process.argv[0], [emptyJsFile]);
node.on('exit', function(exitCode) {
if (exitCode !== 0) {
throw new Error('Error during node startup');
}
i++;
if (i < starts) {
startNode();
} else{
var duration = +new Date - start;
console.log('Started node %d times in %s ms. %d ms / start.', starts, duration, duration / starts);
}
});
}
start = +new Date;
startNode();

View File

@@ -0,0 +1,48 @@
var http = require("http");
var concurrency = 30;
var port = 12346;
var n = 7; // several orders of magnitude slower
var bytes = 1024*5;
var requests = 0;
var responses = 0;
var body = "";
for (var i = 0; i < bytes; i++) {
body += "C";
}
var server = http.createServer(function (req, res) {
res.writeHead(200, {
"Content-Type": "text/plain",
"Content-Length": body.length
});
res.write(body);
res.close();
})
server.listen(port);
function responseListener (res) {
res.addListener("end", function () {
if (requests < n) {
var req = res.client.request("/");
req.addListener('response', responseListener);
req.close();
requests++;
}
if (++responses == n) {
server.close();
}
});
}
for (var i = 0; i < concurrency; i++) {
var client = http.createClient(port);
client.id = i;
var req = client.request("/");
req.addListener('response', responseListener);
req.close();
requests++;
}

View File

@@ -0,0 +1,6 @@
for (var i = 0; i < 9e7; i++) {
s = '01234567890';
s[1] = "a";
}

5
benchmark/timers.js Normal file
View File

@@ -0,0 +1,5 @@
function next (i) {
if (i <= 0) return;
setTimeout(function () { next(i-1); }, 1);
}
next(700);

15
benchmark/v8_bench.js Normal file
View File

@@ -0,0 +1,15 @@
// compare with "google-chrome deps/v8/benchmarks/run.html"
var fs = require('fs');
var path = require('path');
var vm = require('vm');
var dir = path.join(__dirname, '..', 'deps', 'v8', 'benchmarks');
global.print = console.log;
global.load = function (x) {
var source = fs.readFileSync(path.join(dir, x), 'utf8');
vm.runInThisContext(source, x);
}
load('run.js');

4
cmake/CTestCustom.cmake Normal file
View File

@@ -0,0 +1,4 @@
set(CTEST_CUSTOM_PRE_TEST "sh -c \"rm -rf ../test/tmp && mkdir ../test/tmp\"")
set(CTEST_CUSTOM_POST_TEST ${CTEST_CUSTOM_PRE_TEST})
set(CTEST_CUSTOM_PRE_MEMCHECK ${CTEST_CUSTOM_PRE_TEST})
set(CTEST_CUSTOM_POST_MEMCHECK ${CTEST_CUSTOM_PRE_TEST})

View File

@@ -0,0 +1,22 @@
set(toolchain_dir #SET THIS TO YOUR TOOLCHAIN PATH)
set(toolchain_bin_dir ${toolchain_dir}/bin)
set(toolchain_libc_dir ${toolchain_dir}/arm-none-linux-gnueabi/libc)
set(toolchain_inc_dir ${toolchain_libc_dir}/include)
set(toolchain_lib_dir ${toolchain_libc_dir}/usr/lib)
set(CMAKE_SYSTEM_NAME Linux CACHE INTERNAL "system name")
set(CMAKE_SYSTEM_PROCESSOR arm CACHE INTERNAL "processor")
set(CMAKE_C_COMPILER ${toolchain_bin_dir}/arm-none-linux-gnueabi-gcc)
set(CMAKE_CXX_COMPILER ${toolchain_bin_dir}/arm-none-linux-gnueabi-g++)
set(CMAKE_C_FLAGS "-isystem ${toolchain_inc_dir}" CACHE INTERNAL "c compiler flags")
set(CMAKE_CXX_FLAGS "-isystem ${toolchain_inc_dir}" CACHE INTERNAL "cxx compiler flags")
set(link_flags -L${toolchain_lib_dir})
set(CMAKE_EXE_LINKER_FLAGS ${link_flags} CACHE INTERNAL "exe link flags")
set(CMAKE_MODULE_LINKER_FLAGS ${link_flags} CACHE INTERNAL "module link flags")
set(CMAKE_SHARED_LINKER_FLAGS ${link_flags} CACHE INTERNAL "shared lnk flags")
set(CMAKE_FIND_ROOT_PATH ${toolchain_libc_dir} CACHE INTERNAL "cross root directory")
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH CACHE INTERNAL "")
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY CACHE INTERNAL "")
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY CACHE INTERNAL "")

114
cmake/configure.cmake Normal file
View File

@@ -0,0 +1,114 @@
#
# configure node for building
#
include(CheckFunctionExists)
if(NOT "v${CMAKE_BUILD_TYPE}" MATCHES vDebug)
set(CMAKE_BUILD_TYPE "Release")
endif()
string(TOLOWER ${CMAKE_SYSTEM_NAME} node_platform)
if(${node_platform} MATCHES darwin)
execute_process(COMMAND sw_vers -productVersion OUTPUT_VARIABLE OSX_VERSION)
string(REGEX REPLACE "^([0-9]+\\.[0-9]+).*$" "\\1" OSX_VERSION "${OSX_VERSION}")
if(OSX_VERSION GREATER 10.5)
# 10.6 builds are 64-bit
set(CMAKE_SYSTEM_PROCESSOR x86_64)
endif()
endif()
# Get system architecture
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES i686*)
set(node_arch x86)
elseif(${CMAKE_SYSTEM_PROCESSOR} MATCHES i386*)
set(node_arch x86)
else()
set(node_arch ${CMAKE_SYSTEM_PROCESSOR})
endif()
if(${node_arch} MATCHES unknown)
set(node_arch x86)
endif()
set(NODE_INCLUDE_PREFIX ${CMAKE_INSTALL_PREFIX})
# Copy tools directory for out-of-source build
string(COMPARE EQUAL $(PROJECT_BINARY_DIR) ${PROJECT_SOURCE_DIR} in_source_build)
if(NOT in_source_build)
execute_process(COMMAND cmake -E copy_directory ${PROJECT_SOURCE_DIR}/tools ${PROJECT_BINARY_DIR}/tools)
configure_file(${PROJECT_SOURCE_DIR}/deps/v8/tools/jsmin.py ${PROJECT_BINARY_DIR}/tools COPYONLY)
endif()
# Set some compiler/linker flags..
set(CMAKE_C_FLAGS_DEBUG "-O0 -Wall -g -Wextra -DDEBUG $ENV{CFLAGS}")
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -Wall -g -Wextra -DDEBUG $ENV{CXXFLAGS}")
set(CMAKE_C_FLAGS_RELEASE "-g -O3 -DNDEBUG $ENV{CFLAGS}")
set(CMAKE_CXX_FLAGS_RELEASE "-g -O3 -DNDEBUG $ENV{CXXFLAGS}")
if(NOT ${node_platform} MATCHES windows)
add_definitions(-D__POSIX__=1)
endif()
if(${node_platform} MATCHES sunos)
add_definitions(-threads)
elseif(NOT ${node_platform} MATCHES cygwin*)
add_definitions(-pthread)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -rdynamic")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -rdynamic")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pthread")
endif()
if(${node_platform} MATCHES darwin)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -framework Carbon")
# explicitly set this so that we don't check again when building libeio
set(HAVE_FDATASYNC 0)
else()
# OSX fdatasync() check wrong: http://public.kitware.com/Bug/view.php?id=10044
check_function_exists(fdatasync HAVE_FDATASYNC)
endif()
if(HAVE_FDATASYNC)
add_definitions(-DHAVE_FDATASYNC=1)
else()
add_definitions(-DHAVE_FDATASYNC=0)
endif()
if(DTRACE)
if(NOT ${node_platform} MATCHES sunos)
message(FATAL_ERROR "DTrace support only currently available on Solaris")
endif()
find_program(dtrace_bin dtrace)
if(NOT dtrace_bin)
message(FATAL_ERROR "DTrace binary not found")
endif()
add_definitions(-DHAVE_DTRACE=1)
endif()
add_definitions(
-DPLATFORM="${node_platform}"
-DX_STACKSIZE=65536
-D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64
-DEV_MULTIPLICITY=0
-D_FORTIFY_SOURCE=2
)
# set the exec output path to be compatible with the current waf build system
if(${CMAKE_BUILD_TYPE} MATCHES Debug)
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/debug/)
else()
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/default/)
endif()
#
## ---------------------------------------------------------
#
file(GLOB js2c_files ${PROJECT_SOURCE_DIR}/lib/*.js)
set(js2c_files ${PROJECT_SOURCE_DIR}/src/node.js ${js2c_files})
file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/src)

80
cmake/docs.cmake Normal file
View File

@@ -0,0 +1,80 @@
#
# docs
#
file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/doc)
set(node_binary ${PROJECT_BINARY_DIR}/default/node)
set(doctool tools/doctool/doctool.js)
set(changelog_html ${PROJECT_BINARY_DIR}/doc/changelog.html)
file(GLOB_RECURSE doc_sources RELATIVE ${PROJECT_SOURCE_DIR} doc/*)
foreach(FILE ${doc_sources})
string(REGEX REPLACE "(.*)api_assets(.*)" "\\1api/assets\\2" OUT_FILE ${FILE})
add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/${OUT_FILE}
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${PROJECT_SOURCE_DIR}/${FILE} ${PROJECT_BINARY_DIR}/${OUT_FILE}
DEPENDS ${PROJECT_SOURCE_DIR}/${FILE}
)
list(APPEND doc_sources_copy ${PROJECT_BINARY_DIR}/${OUT_FILE})
endforeach()
file(GLOB_RECURSE api_markdown RELATIVE ${PROJECT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/doc/api/*)
foreach(file ${api_markdown})
string(REGEX REPLACE "(.*)\\.markdown" "\\1" tmp ${file})
set(api_basenames ${api_basenames} ${tmp})
endforeach()
foreach(api ${api_basenames})
set(api_html ${api_html} ${PROJECT_BINARY_DIR}/${api}.html)
add_custom_command(
OUTPUT "${PROJECT_BINARY_DIR}/${api}.html"
COMMAND ${node_binary} ${doctool} ${PROJECT_BINARY_DIR}/doc/template.html "${PROJECT_BINARY_DIR}/${api}.markdown" > "${PROJECT_BINARY_DIR}/${api}.html"
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
DEPENDS node ${doctool} ${doc_sources_copy}
VERBATIM
)
endforeach()
add_custom_target(
doc
DEPENDS node ${doc_sources_copy} ${api_html} ${changelog_html}
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
)
#add_custom_command(
# OUTPUT ${PROJECT_BINARY_DIR}/doc/api.html
# COMMAND ${PROJECT_BINARY_DIR}/default/node tools/ronnjs/bin/ronn.js --fragment doc/api.markdown
# | sed "s/<h2>\\\(.*\\\)<\\/h2>/<h2 id=\"\\1\">\\1<\\/h2>/g"
# | cat doc/api_header.html - doc/api_footer.html > ${PROJECT_BINARY_DIR}/doc/api.html
# WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
# DEPENDS node doc/api.markdown doc/api_header.html doc/api_footer.html
# VERBATIM
# )
add_custom_command(
OUTPUT ${changelog_html}
COMMAND ${node_binary} ${doctool} doc/template.html ChangeLog
| sed "s|assets/|api/assets/|g"
| sed "s|<body>|<body id=\"changelog\">|g" > ${changelog_html}
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
DEPENDS ChangeLog node ${doctool} ${doc_sources_copy}
VERBATIM
)
#add_custom_command(
# OUTPUT ${PROJECT_BINARY_DIR}/doc/changelog.html
# COMMAND cat doc/changelog_header.html ChangeLog doc/changelog_footer.html > ${PROJECT_BINARY_DIR}/doc/changelog.html
# WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
# DEPENDS ChangeLog doc/changelog_header.html doc/changelog_footer.html
# VERBATIM
# )
#add_custom_command(
# OUTPUT ${PROJECT_BINARY_DIR}/doc/node.1
# COMMAND ${PROJECT_BINARY_DIR}/default/node tools/ronnjs/bin/ronn.js --roff doc/api.markdown > ${PROJECT_BINARY_DIR}/doc/node.1
# WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
# DEPENDS node doc/api.markdown tools/ronnjs/bin/ronn.js
# VERBATIM
# )

18
cmake/libc-ares.cmake Normal file
View File

@@ -0,0 +1,18 @@
if(SHARED_CARES)
find_library(LIBCARES_LIBRARY NAMES cares)
find_path(LIBCARES_INCLUDE_DIR ares.h
PATH_SUFFIXES include
) # Find header
find_package_handle_standard_args(libcares DEFAULT_MSG LIBCARES_LIBRARY LIBCARES_INCLUDE_DIR)
else()
set(cares_arch ${node_arch})
if(${node_arch} MATCHES x86_64)
set(cares_arch x64)
elseif(${node_arch} MATCHES x86)
set(cares_arch ia32)
endif()
add_subdirectory(deps/c-ares)
set(LIBCARES_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/deps/c-ares ${CMAKE_SOURCE_DIR}/deps/c-ares/${node_platform}-${cares_arch})
endif()

10
cmake/libev.cmake Normal file
View File

@@ -0,0 +1,10 @@
if(SHARED_LIBEV)
find_library(LIBEV_LIBRARY NAMES ev)
find_path(LIBEV_INCLUDE_DIR ev.h
PATH_SUFFIXES include/ev include
) # Find header
find_package_handle_standard_args(libev DEFAULT_MSG LIBEV_LIBRARY LIBEV_INCLUDE_DIR)
else()
add_subdirectory(deps/libev)
set(LIBEV_INCLUDE_DIR deps/libev)
endif()

55
cmake/libs.cmake Normal file
View File

@@ -0,0 +1,55 @@
#
# libraries
#
include(CheckLibraryExists)
include(FindPackageHandleStandardArgs)
set(HAVE_CONFIG_H True)
add_definitions(-DHAVE_CONFIG_H=1)
find_package(OpenSSL QUIET)
find_package(Threads)
find_library(RT rt)
find_library(DL dl)
check_library_exists(socket socket "" HAVE_SOCKET_LIB)
check_library_exists(nsl gethostbyname "" HAVE_NSL_LIB)
check_library_exists(util openpty "" HAVE_UTIL_LIB)
if(RT)
set(extra_libs ${extra_libs} ${RT})
endif()
if(DL)
set(extra_libs ${extra_libs} ${DL})
endif()
if(${node_platform} MATCHES freebsd)
find_library(KVM NAMES kvm)
set(extra_libs ${extra_libs} KVM)
endif()
if(${HAVE_SOCKET_LIB})
set(extra_libs ${extra_libs} socket)
endif()
if(${HAVE_NSL_LIB})
set(extra_libs ${extra_libs} nsl)
endif()
if(HAVE_UTIL_LIB)
set(extra_libs ${extra_libs} util)
endif()
if(OPENSSL_FOUND)
add_definitions(-DHAVE_OPENSSL=1)
set(HAVE_OPENSSL True)
set(node_extra_src ${node_extra_src} src/node_crypto.cc)
set(extra_libs ${extra_libs} ${OPENSSL_LIBRARIES})
endif()
include("cmake/libc-ares.cmake")
include("cmake/libev.cmake")
include("cmake/libv8.cmake")
add_subdirectory(deps/libeio)
add_subdirectory(deps/http_parser)

25
cmake/libv8.cmake Normal file
View File

@@ -0,0 +1,25 @@
set(V8_INCLUDE_NAMES v8.h v8-debug.h v8-profiler.h v8stdint.h)
set(V8_LIBRARY_NAMES v8)
if(SHARED_V8)
find_path(V8_INCLUDE_DIR NAMES ${V8_INCLUDE_NAMES})
find_library(V8_LIBRARY_PATH NAMES ${V8_LIBRARY_NAMES} NO_CMAKE_PATH)
else()
set(V8_INCLUDE_DIR "${PROJECT_BINARY_DIR}/deps/v8/include")
if(${CMAKE_BUILD_TYPE} MATCHES Debug)
set(v8_fn "libv8_g.a")
else()
set(v8_fn "libv8.a")
endif()
set(V8_LIBRARY_PATH "${PROJECT_BINARY_DIR}/deps/v8/${v8_fn}")
install(DIRECTORY
## Do NOT remove the trailing slash
## it is required so that v8 headers are
## copied directly into include/node
## rather than in a subdirectory
## See CMake's install(DIRECTORY) manual for details
${V8_INCLUDE_DIR}/
DESTINATION include/node
)
endif()

146
cmake/node_build.cmake Normal file
View File

@@ -0,0 +1,146 @@
#
# node build stuff
#
set(macros_file ${PROJECT_BINARY_DIR}/macros.py)
# replace debug(x) and assert(x) with nothing in release build
if(${CMAKE_BUILD_TYPE} MATCHES Release)
file(APPEND ${macros_file} "macro debug(x) = void(0);\n")
file(APPEND ${macros_file} "macro assert(x) = void(0);\n")
endif()
if(NOT DTRACE)
set(dtrace_probes
DTRACE_HTTP_CLIENT_REQUEST
DTRACE_HTTP_CLIENT_RESPONSE
DTRACE_HTTP_SERVER_REQUEST
DTRACE_HTTP_SERVER_RESPONSE
DTRACE_NET_SERVER_CONNECTION
DTRACE_NET_STREAM_END
DTRACE_NET_SOCKET_READ
DTRACE_NET_SOCKET_WRITE)
foreach(probe ${dtrace_probes})
file(APPEND ${macros_file} "macro ${probe}(x) = void(0);\n")
endforeach()
endif()
# Sort the JS files being built into natives so that the build is
# deterministic
list(SORT js2c_files)
# include macros file in generation
set(js2c_files ${js2c_files} ${macros_file})
add_custom_command(
OUTPUT ${PROJECT_BINARY_DIR}/src/node_natives.h
COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_BINARY_DIR}/tools/js2c.py ${PROJECT_BINARY_DIR}/src/node_natives.h ${js2c_files}
DEPENDS ${js2c_files})
set(node_platform_src "src/platform_${node_platform}.cc")
if(NOT EXISTS ${CMAKE_SOURCE_DIR}/${node_platform_src})
set(node_extra_src ${node_extra_src} "src/platform_none.cc")
else()
set(node_extra_src ${node_extra_src} ${node_platform_src})
endif()
set(node_sources
src/node_main.cc
src/node.cc
src/node_buffer.cc
src/node_javascript.cc
src/node_extensions.cc
src/node_http_parser.cc
src/node_net.cc
src/node_io_watcher.cc
src/node_child_process.cc
src/node_constants.cc
src/node_cares.cc
src/node_events.cc
src/node_file.cc
src/node_signal_watcher.cc
src/node_stat_watcher.cc
src/node_stdio.cc
src/node_timer.cc
src/node_script.cc
src/node_os.cc
src/node_dtrace.cc
src/node_string.cc
src/node_natives.h
${node_extra_src})
# Set up PREFIX, CCFLAGS, and CPPFLAGS for node_config.h
set(PREFIX ${CMAKE_INSTALL_PREFIX})
if(${CMAKE_BUILD_TYPE} MATCHES Debug)
set(CCFLAGS "${CMAKE_C_FLAGS_DEBUG} ${CMAKE_C_FLAGS}")
else()
set(CCFLAGS "${CMAKE_C_FLAGS_RELEASE} ${CMAKE_C_FLAGS}")
endif()
get_directory_property(compile_defs COMPILE_DEFINITIONS)
foreach(def ${compile_defs})
set(CPPFLAGS "${CPPFLAGS} -D${def}")
endforeach()
configure_file(src/node_config.h.in ${PROJECT_BINARY_DIR}/src/node_config.h ESCAPE_QUOTES)
configure_file(config.h.cmake ${PROJECT_BINARY_DIR}/config.h)
include_directories(
src
deps/libeio
deps/http_parser
${V8_INCLUDE_DIR}
${LIBEV_INCLUDE_DIR}
${LIBCARES_INCLUDE_DIR}
${PROJECT_BINARY_DIR}
${PROJECT_BINARY_DIR}/src
)
if(DTRACE)
add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/src/node_provider.h
COMMAND ${dtrace_bin} -x nolibs -h -o ${PROJECT_BINARY_DIR}/src/node_provider.h -s ${PROJECT_SOURCE_DIR}/src/node_provider.d
DEPENDS ${PROJECT_SOURCE_DIR}/src/node_provider.d)
set(node_sources ${node_sources} src/node_provider.o)
set(node_sources src/node_provider.h ${node_sources})
endif()
add_executable(node ${node_sources})
set_target_properties(node PROPERTIES DEBUG_POSTFIX "_g")
target_link_libraries(node
ev
eio
cares
http_parser
${V8_LIBRARY_PATH}
${CMAKE_THREAD_LIBS_INIT}
${extra_libs})
if(DTRACE)
# manually gather up the object files for dtrace
get_property(sourcefiles TARGET node PROPERTY SOURCES)
foreach(src_file ${sourcefiles})
if(src_file MATCHES ".*\\.cc$")
set(node_objs ${node_objs} ${PROJECT_BINARY_DIR}/CMakeFiles/node.dir/${src_file}.o)
endif()
endforeach()
add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/src/node_provider.o
#COMMAND cmake -E echo ${node_objs}
COMMAND ${dtrace_bin} -G -x nolibs -s ${PROJECT_SOURCE_DIR}/src/node_provider.d -o ${PROJECT_BINARY_DIR}/src/node_provider.o ${node_objs}
DEPENDS ${node_objs})
endif()
install(TARGETS node RUNTIME DESTINATION bin)
install(FILES
${PROJECT_BINARY_DIR}/config.h
src/node.h
src/node_object_wrap.h
src/node_buffer.h
src/node_events.h
src/node_version.h
${PROJECT_BINARY_DIR}/src/node_config.h
DESTINATION ${NODE_INCLUDE_PREFIX}/include/node
)

39
cmake/package.cmake Normal file
View File

@@ -0,0 +1,39 @@
#
# package
#
# Allow absolute paths when installing
# see http://www.cmake.org/pipermail/cmake/2008-July/022958.html
set(CPACK_SET_DESTDIR "ON")
if(${node_platform} MATCHES darwin)
set(CPACK_GENERATOR "TGZ;PackageMaker")
# CPack requires the files to end in .txt
configure_file(LICENSE ${PROJECT_BINARY_DIR}/LICENSE.txt COPYONLY)
configure_file(ChangeLog ${PROJECT_BINARY_DIR}/ChangeLog.txt COPYONLY)
set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_BINARY_DIR}/LICENSE.txt")
set(CPACK_RESOURCE_FILE_README "${PROJECT_BINARY_DIR}/ChangeLog.txt")
#set(CPACK_RESOURCE_FILE_WELCOME "")
elseif(${node_platform} MATCHES linux)
set(CPACK_GENERATOR "TGZ;DEB;RPM")
else()
set(CPACK_GENERATOR "TGZ")
endif()
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Tom Hughes <tom.hughes@palm.com>")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Evented I/O for V8 JavaScript.")
set(CPACK_PACKAGE_DESCRIPTION "Evented I/O for V8 JavaScript.
Node's goal is to provide an easy way to build scalable network programs.
Node is similar in design to and influenced by systems like Ruby's Event
Machine or Python's Twisted. Node takes the event model a bit further—it
presents the event loop as a language construct instead of as a library.")
set(CPACK_DEBIAN_PACKAGE_DESCRIPTION "${CPACK_PACKAGE_DESCRIPTION}")
set(CPACK_DEBIAN_PACKAGE_SECTION "web")
file(READ ${PROJECT_SOURCE_DIR}/src/node_version.h node_version_h OFFSET 0)
string(REGEX REPLACE ".*NODE_MAJOR_VERSION[ ]*([0-9]+).*" "\\1" CPACK_PACKAGE_VERSION_MAJOR "${node_version_h}")
string(REGEX REPLACE ".*NODE_MINOR_VERSION[ ]*([0-9]+).*" "\\1" CPACK_PACKAGE_VERSION_MINOR "${node_version_h}")
string(REGEX REPLACE ".*NODE_PATCH_VERSION[ ]*([0-9]+).*" "\\1" CPACK_PACKAGE_VERSION_PATCH "${node_version_h}")
set(node_version_string "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
# Note: this is intentionally at the bottom so that the above CPACK variables
# are used by CPack.
include(CPack)

102
cmake/v8_build.cmake Normal file
View File

@@ -0,0 +1,102 @@
#
# v8 build stuff
#
string(TOLOWER ${CMAKE_BUILD_TYPE} v8mode)
set(v8arch ${node_arch})
if(${node_arch} MATCHES x86_64)
set(v8arch x64)
elseif(${node_arch} MATCHES x86)
set(v8arch ia32)
endif()
if(NOT SHARED_V8)
if(V8_SNAPSHOT)
set(v8_snapshot snapshot=on)
endif()
if(V8_OPROFILE)
set(v8_oprofile prof=oprofile)
endif()
if(V8_GDBJIT)
set(v8_gdbjit gdbjit=on)
endif()
if(${node_platform} MATCHES darwin)
execute_process(COMMAND hwprefs cpu_count OUTPUT_VARIABLE cpu_count)
elseif(${node_platform} MATCHES linux)
execute_process(COMMAND sh -c "cat /proc/cpuinfo | grep processor | sort | uniq | wc -l"
OUTPUT_VARIABLE cpu_count)
elseif(${node_platform} MATCHES sunos)
execute_process(COMMAND sh -c "psrinfo | wc -l" OUTPUT_VARIABLE cpu_count)
else()
set(cpu_count 1)
endif()
if(${cpu_count} GREATER 1)
math(EXPR parallel_jobs ${cpu_count}*2)
else()
set(parallel_jobs 1)
endif()
add_library(v8 STATIC IMPORTED)
set_property(TARGET v8
PROPERTY IMPORTED_LOCATION ${PROJECT_BINARY_DIR}/deps/v8/${v8_fn})
set(compile_env_vars "CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER} AR=${CMAKE_AR} RANLIB=${CMAKE_RANLIB} CFLAGS=\"${CMAKE_C_FLAGS}\" CXXFLAGS=\"${CMAKE_CXX_FLAGS}\" LDFLAGS=\"${CMAKE_EXE_LINKER_FLAGS}\"")
set(compile_cmd "${compile_env_vars} ${PYTHON_EXECUTABLE} ${PROJECT_BINARY_DIR}/tools/scons/scons.py -j ${parallel_jobs} visibility=default mode=${v8mode} arch=${v8arch} library=static ${v8_snapshot} ${v8_oprofile} ${v8_gdbjit} verbose=on")
if(CMAKE_VERSION VERSION_GREATER 2.8 OR CMAKE_VERSION VERSION_EQUAL 2.8)
# use ExternalProject for CMake >2.8
include(ExternalProject)
ExternalProject_Add(v8_extprj
URL ${PROJECT_SOURCE_DIR}/deps/v8
BUILD_IN_SOURCE True
BUILD_COMMAND sh -c "${compile_cmd}"
SOURCE_DIR ${PROJECT_BINARY_DIR}/deps/v8
# ignore this stuff, it's not needed for building v8 but ExternalProject
# demands these steps
CONFIGURE_COMMAND "true" # fake configure
INSTALL_COMMAND "true" # fake install
)
add_dependencies(node v8_extprj)
else()
# copy v8 sources inefficiently with CMake versions <2.8
file(GLOB_RECURSE v8_sources RELATIVE ${PROJECT_SOURCE_DIR} deps/v8/*)
if(NOT ${in_source_build})
file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/deps/v8)
foreach(FILE ${v8_sources})
add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/${FILE}
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${PROJECT_SOURCE_DIR}/${FILE} ${PROJECT_BINARY_DIR}/${FILE}
DEPENDS ${PROJECT_SOURCE_DIR}/${FILE}
)
list(APPEND v8_sources_dest ${PROJECT_BINARY_DIR}/${FILE})
endforeach()
else()
set(v8_sources_dest ${v8_sources})
endif()
add_custom_command(
OUTPUT ${PROJECT_BINARY_DIR}/deps/v8/${v8_fn}
COMMAND sh -c "${compile_cmd}"
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/deps/v8/
DEPENDS ${v8_sources_dest}
)
add_custom_target(v8_stock ALL DEPENDS ${PROJECT_BINARY_DIR}/deps/v8/${v8_fn})
set_property(TARGET v8 PROPERTY
IMPORTED_LOCATION ${PROJECT_BINARY_DIR}/deps/v8/${v8_fn})
add_dependencies(node v8_stock)
endif()
endif()

2
config.h.cmake Normal file
View File

@@ -0,0 +1,2 @@
#cmakedefine HAVE_OPENSSL 1
#cmakedefine HAVE_CONFIG_H 1

126
configure vendored
View File

@@ -1,129 +1,21 @@
#! /bin/sh
# waf configure wrapper
# Fancy colors used to beautify the output a bit.
#
NORMAL=""
BOLD=""
RED=""
YELLOW=""
GREEN=""
EXIT_SUCCESS=0
EXIT_FAILURE=1
EXIT_ERROR=2
EXIT_BUG=10
# v8 doesn't like ccache
if [ ! -z "`echo $CC | grep ccache`" ]; then
echo "Error: V8 doesn't like cache. Please set your CC env var to 'gcc'"
echo " (ba)sh: export CC=gcc"
exit 1
fi
CUR_DIR=$PWD
#possible relative path
WORKINGDIR=`dirname $0`
cd $WORKINGDIR
cd "$WORKINGDIR"
#abs path
WORKINGDIR=`pwd`
cd $CUR_DIR
cd "$CUR_DIR"
WAF="${WORKINGDIR}/tools/waf"
# Checks for WAF. Honours $WAF if set. Stores path to 'waf' in $WAF.
# Requires that $PYTHON is set.
#
checkWAF()
{
printf "Checking for WAF\t\t\t: "
#installed miniwaf in sourcedir
if [ -z "$WAF" ] ; then
if [ -f "${WORKINGDIR}/waf" ] ; then
WAF="${WORKINGDIR}/waf"
if [ ! -x "$WAF" ] ; then
chmod +x $WAF
fi
fi
fi
if [ -z "$WAF" ] ; then
if [ -f "${WORKINGDIR}/waf-light" ] ; then
${WORKINGDIR}/waf-light --make-waf
WAF="${WORKINGDIR}/waf"
fi
fi
#global installed waf with waf->waf.py link
if [ -z "$WAF" ] ; then
WAF=`which waf 2>/dev/null`
fi
# neither waf nor miniwaf could be found
if [ ! -x "$WAF" ] ; then
printf $RED"not found"$NORMAL"\n"
echo "Go to http://code.google.com/p/waf/"
echo "and download a waf version"
exit $EXIT_FAILURE
else
printf $GREEN"$WAF"$NORMAL"\n"
fi
}
# Generates a Makefile. Requires that $WAF is set.
#
generateMakefile()
{
cat > Makefile << EOF
#!/usr/bin/make -f
# Waf Makefile wrapper
WAF_HOME=$CUR_DIR
all:
@$WAF build
all-debug:
@$WAF -v build
all-progress:
@$WAF -p build
install:
if test -n "\$(DESTDIR)"; then \\
$WAF install --destdir="\$(DESTDIR)" ; \\
else \\
$WAF install ; \\
fi;
uninstall:
@if test -n "\$(DESTDIR)"; then \\
$WAF uninstall --destdir="\$(DESTDIR)" ; \\
else \\
$WAF uninstall ; \\
fi;
test: all
python tools/test.py --mode=release
test-debug: all
python tools/test.py --mode=debug
clean:
@$WAF clean
distclean:
@$WAF distclean
@-rm -rf _build_
@-rm -f Makefile
@-rm -f *.pyc
check:
@$WAF check
dist:
@$WAF dist
.PHONY: clean dist distclean check uninstall install all test
EOF
}
checkWAF
generateMakefile
"${WAF}" configure $*
"${WORKINGDIR}/tools/waf-light" --jobs=1 configure $*
exit $?

37
deps/c-ares/AUTHORS vendored Normal file
View File

@@ -0,0 +1,37 @@
c-ares is based on ares, and these are the people that have worked on it since
the fork was made:
Alexander Lazic
Alexey Simak
Andreas Rieke
Ashish Sharma
Brad House
Brad Spencer
Bram Matthys
Dan Fandrich
Daniel Stenberg
Dirk Manske
Dominick Meglio
Doug Goldstein
Duncan Wilcox
Eino Tuominen
Erik Kline
George Neill
Gisle Vanem
Guilherme Balena Versiani
Gunter Knauf
Henrik Stoerner
James Bursa
Michael Wallner
Nick Mathewson
Phil Blundell
Ravi Pratap
Robin Cornelius
Sebastian at basti79.de
Shmulik Regev
Steinar H. Gunderson
Tofu Linden
Vlad Dinulescu
William Ahern
Yang Tse
liren at vivisimo.com

1198
deps/c-ares/CHANGES vendored Normal file

File diff suppressed because it is too large Load Diff

22
deps/c-ares/CMakeLists.txt vendored Normal file
View File

@@ -0,0 +1,22 @@
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${node_platform}-${cares_arch})
add_definitions(-DHAVE_CONFIG_H=1)
include(CheckLibraryExists)
check_library_exists(socket socket "" HAVE_SOCKET_LIB)
check_library_exists(nsl gethostbyname "" HAVE_NSL_LIB)
file(GLOB lib_sources *.c)
add_library(cares ${lib_sources})
if(${HAVE_SOCKET_LIB})
set(cares_libs ${cares_libs} socket)
endif()
if(${HAVE_NSL_LIB})
set(cares_libs ${cares_libs} nsl)
endif()
if(cares_libs)
target_link_libraries(cares ${cares_libs})
endif()

21
deps/c-ares/NEWS vendored Normal file
View File

@@ -0,0 +1,21 @@
Major changes since:
* see the CHANGES file
Major changes in release 1.1.1:
* ares should now compile as C++ code (no longer uses reserved word
"class").
* Added SRV support to adig test program.
* Fixed a few error handling bugs in query processing.
Major changes in release 1.1.0:
* Added ares_free_string() function so that memory can be freed in the
same layer as it is allocated, a desirable feature in some
environments.
* A few of the ares_dns.h macros are fixed to use the proper bitwise
operator.
* Fixed a couple of fenceposts fixed in ares_expand_name()'s
bounds-checking.
* In process_timeouts(), extract query->next before calling
next_server() and possibly freeing the query structure.
* Casted arguments to ctype macros casted to unsigned char, since not
all char values are valid inputs to those macros according to ANSI.

60
deps/c-ares/README vendored Normal file
View File

@@ -0,0 +1,60 @@
c-ares
======
This is c-ares, an asynchronous resolver library. It is intended for
applications which need to perform DNS queries without blocking, or need to
perform multiple DNS queries in parallel. The primary examples of such
applications are servers which communicate with multiple clients and programs
with graphical user interfaces.
The full source code is available in the 'c-ares' release archives, and in a
git repository: http://github.com/bagder/c-ares
If you find bugs, correct flaws, have questions or have comments in general in
regard to c-ares (or by all means the original ares too), get in touch with us
on the c-ares mailing list: http://cool.haxx.se/mailman/listinfo/c-ares
c-ares is of course distributed under the same MIT-style license as the
original ares.
You'll find all c-ares details and news here:
http://c-ares.haxx.se/
NOTES FOR C-ARES HACKERS
The following notes apply to c-ares version 1.7.0 and later.
* The distributed ares_build.h file is only intended to be used on systems
which can not run the also distributed configure script.
* The distributed ares_build.h file is generated as a copy of ares_build.h.dist
when the c-ares source code distribution archive file is originally created.
* If you check out from git on a non-configure platform, you must run the
appropriate buildconf* script to set up ares_build.h and other local files
before being able of compiling the library.
* On systems capable of running the configure script, the configure process
will overwrite the distributed ares_build.h file with one that is suitable
and specific to the library being configured and built, this new file is
generated from the ares_build.h.in template file.
* If you intend to distribute an already compiled c-ares library you _MUST_
also distribute along with it the generated ares_build.h which has been
used to compile it. Otherwise the library will be of no use for the users of
the library that you have built. It is _your_ responsibility to provide this
file. No one at the c-ares project can know how you have built the library.
* File ares_build.h includes platform and configuration dependent info,
and must not be modified by anyone. Configure script generates it for you.
* We cannot assume anything else but very basic compiler features being
present. While c-ares requires an ANSI C compiler to build, some of the
earlier ANSI compilers clearly can't deal with some preprocessor operators.
* Newlines must remain unix-style for older compilers' sake.
* Comments must be written in the old-style /* unnested C-fashion */

13
deps/c-ares/README.cares vendored Normal file
View File

@@ -0,0 +1,13 @@
c-ares
======
This package is based on ares 1.1.1 (written by Greg Hudson). I decided to
fork and release a separate project since the ares author didn't want the
improvements that were vital for our use of it.
This package is dubbed 'c-ares' since I (Daniel Stenberg) wanted this for use
within the curl project (hence the letter C) and it makes a nice pun. Also,
c-ares is not API compatible with ares: a new name makes that more obvious to
the public.
The original libares was distributed at athena-dist.mit.edu:pub/ATHENA/ares.

118
deps/c-ares/README.msvc vendored Normal file
View File

@@ -0,0 +1,118 @@
___ __ _ _ __ ___ ___
/ __| ___ / _` | '__/ _ \/ __|
| (_ |___| (_| | | | __/\__ \
\___| \__,_|_| \___||___/
How to build c-ares using MSVC or Visual Studio
=================================================
How to build using MSVC from the command line
---------------------------------------------
Open a command prompt window and ensure that the environment is properly
set up in order to use MSVC or Visual Studio compiler tools.
Change to c-ares source folder where Makefile.msvc file is located and run:
> nmake -f Makefile.msvc
This will build all c-ares libraries as well as three sample programs.
Once the above command has finished a new folder named MSVCXX will exist
below the folder where makefile.msvc is found. The name of the folder
depends on the MSVC compiler version being used to build c-ares.
Below the MSVCXX folder there will exist four folders named 'cares',
'ahost', 'acountry', and 'adig'. The 'cares' folder is the one that
holds the c-ares libraries you have just generated, the other three
hold sample programs that use the libraries.
The above command builds four versions of the c-ares library, dynamic
and static versions and each one in release and debug flavours. Each
of these is found in folders named dll-release, dll-debug, lib-release,
and lib-debug, which hang from the 'cares' folder mentioned above. Each
sample program also has folders with the same names to reflect which
library version it is using.
How to build using Visual Studio 6 IDE
--------------------------------------
A VC++ 6.0 reference workspace (vc6aws.dsw) is available within the 'vc'
folder to allow proper building of the library and sample programs.
1) Open the vc6aws.dsw workspace with MSVC6's IDE.
2) Select 'Build' from top menu.
3) Select 'Batch Build' from dropdown menu.
4) Make sure that the sixteen project configurations are 'checked'.
5) Click on the 'Build' button.
6) Once the sixteen project configurations are built you are done.
Dynamic and static c-ares libraries are built in debug and release flavours,
and can be located each one in its own subdirectory, dll-debug, dll-release,
lib-debug and lib-release, all of them below the 'vc\cares' subdirectory.
In the same way four executable versions of each sample program are built,
each using its respective library. The resulting sample executables are
located in its own subdirectory, dll-debug, dll-release, lib-debug and
lib-release, below the 'vc\acountry', 'vc\adig' and 'vc\ahost'folders.
These reference VC++ 6.0 configurations are generated using the dynamic CRT.
How to build using Visual Studio 2003 or newer IDE
--------------------------------------------------
First you have to convert the VC++ 6.0 reference workspace and project files
to the Visual Studio IDE version you are using, following next steps:
1) Open vc\vc6aws.dsw with VS20XX.
2) Allow VS20XX to update all projects and workspaces.
3) Save ALL and close VS20XX.
4) Open vc\vc6aws.sln with VS20XX.
5) Select batch build, check 'all' projects and click 'build' button.
Same comments relative to generated files and folders as done above for
Visual Studio 6 IDE apply here.
Relationship between c-ares library file names and versions
-----------------------------------------------------------
c-ares static release library version files:
libcares.lib -> static release library
c-ares static debug library version files:
libcaresd.lib -> static debug library
c-ares dynamic release library version files:
cares.dll -> dynamic release library
cares.lib -> import library for the dynamic release library
cares.exp -> export file for the dynamic release library
c-ares dynamic debug library version files:
caresd.dll -> dynamic debug library
caresd.lib -> import library for the dynamic debug library
caresd.exp -> export file for the dynamic debug library
caresd.pdb -> debug symbol file for the dynamic debug library
How to use c-ares static libraries
----------------------------------
When using the c-ares static library in your program, you will have to
define preprocessor symbol CARES_STATICLIB while building your program,
otherwise you will get errors at linkage stage.
Have Fun!

21
deps/c-ares/README.node vendored Normal file
View File

@@ -0,0 +1,21 @@
Library: c-ares, DNS resolver
Version: 1.7.3 (11 June, 2010)
Authors: Greg Hudson, Daniel Stenberg
License: MIT
Notes:
Just use waf instead of the autoconf based configure script. Delete most of
the documentation and other files distributed with it. To upgrade, run
./configure on linux, macintosh, solaris (and other supported platforms) and
copy
- ares_config.h
- ares_setup.h
- ares_build.h
into the appropriate directory.

25
deps/c-ares/RELEASE-NOTES vendored Normal file
View File

@@ -0,0 +1,25 @@
c-ares version 1.7.4
Changed:
o local-bind: Support binding to local interface/IPs, see
ares_set_local_ip4, ares_set_local_ip6, ares_set_local_dev
Fixed:
o memory leak in ares_getnameinfo
o add missing break that caused get_ares_servers to fail
o ares_parse_a_reply: fix CNAME response parsing
o init_by_options: don't copy an empty sortlist
o Replaced uint32_t with unsigned int to fix broken builds
on a couple of platforms
o Fix lookup with HOSTALIASES set
o adig: fix NAPTR parsing
o compiler warning cleanups
Thanks go to these friendly people for their efforts and contributions:
Andrew C. Morrow, Ben Greear, Ben Noordhuis, Daniel Stenberg,
Guenter Knauf, Mike Crowe, Patrik Thunstrom, Yang Tse
Have fun!

23
deps/c-ares/TODO vendored Normal file
View File

@@ -0,0 +1,23 @@
TODO
====
ares_reinit()
- To allow an app to force a re-read of /etc/resolv.conf etc, pretty much
like the res_init() resolver function offers
ares_gethostbyname
- When built to support IPv6, it needs to also support PF_UNSPEC or similar,
so that an application can ask for any protocol and then c-ares would return
all known resolves and not just explicitly IPv4 _or_ IPv6 resolves.
ares_process
- Upon next ABI breakage ares_process() should be changed to return 'int'
and return ARES_ENOTINITIALIZED if ares_library_init() has not been called.
ares_process_fd
- Upon next ABI breakage ares_process_fd() should be changed to return
'int' and return ARES_ENOTINITIALIZED if library has not been initialized.

537
deps/c-ares/ares.h vendored Normal file
View File

@@ -0,0 +1,537 @@
/* Copyright 1998, 2009 by the Massachusetts Institute of Technology.
* Copyright (C) 2007-2010 by Daniel Stenberg
*
* Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without
* fee is hereby granted, provided that the above copyright
* notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting
* documentation, and that the name of M.I.T. not be used in
* advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is"
* without express or implied warranty.
*/
#ifndef ARES__H
#define ARES__H
#include "ares_version.h" /* c-ares version defines */
#include "ares_build.h" /* c-ares build definitions */
#include "ares_rules.h" /* c-ares rules enforcement */
/*
* Define WIN32 when build target is Win32 API
*/
#if (defined(_WIN32) || defined(__WIN32__)) && \
!defined(WIN32) && !defined(__SYMBIAN32__)
# define WIN32
#endif
#include <sys/types.h>
/* HP-UX systems version 9, 10 and 11 lack sys/select.h and so does oldish
libc5-based Linux systems. Only include it on system that are known to
require it! */
#if defined(_AIX) || defined(__NOVELL_LIBC__) || defined(__NetBSD__) || \
defined(__minix) || defined(__SYMBIAN32__) || defined(__INTEGRITY)
#include <sys/select.h>
#endif
#if (defined(NETWARE) && !defined(__NOVELL_LIBC__))
#include <sys/bsdskt.h>
#endif
#if defined(WATT32)
# include <netinet/in.h>
# include <sys/socket.h>
# include <tcp.h>
#elif defined(WIN32)
# ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN
# endif
# include <windows.h>
# include <winsock2.h>
# include <ws2tcpip.h>
#else
# include <sys/socket.h>
# include <netinet/in.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*
** c-ares external API function linkage decorations.
*/
#if !defined(CARES_STATICLIB) && \
(defined(WIN32) || defined(_WIN32) || defined(__SYMBIAN32__))
/* __declspec function decoration for Win32 and Symbian DLL's */
# if defined(CARES_BUILDING_LIBRARY)
# define CARES_EXTERN __declspec(dllexport)
# else
# define CARES_EXTERN __declspec(dllimport)
# endif
#else
/* visibility function decoration for other cases */
# if !defined(CARES_SYMBOL_HIDING) || \
defined(WIN32) || defined(_WIN32) || defined(__SYMBIAN32__)
# define CARES_EXTERN
# else
# define CARES_EXTERN CARES_SYMBOL_SCOPE_EXTERN
# endif
#endif
#define ARES_SUCCESS 0
/* Server error codes (ARES_ENODATA indicates no relevant answer) */
#define ARES_ENODATA 1
#define ARES_EFORMERR 2
#define ARES_ESERVFAIL 3
#define ARES_ENOTFOUND 4
#define ARES_ENOTIMP 5
#define ARES_EREFUSED 6
/* Locally generated error codes */
#define ARES_EBADQUERY 7
#define ARES_EBADNAME 8
#define ARES_EBADFAMILY 9
#define ARES_EBADRESP 10
#define ARES_ECONNREFUSED 11
#define ARES_ETIMEOUT 12
#define ARES_EOF 13
#define ARES_EFILE 14
#define ARES_ENOMEM 15
#define ARES_EDESTRUCTION 16
#define ARES_EBADSTR 17
/* ares_getnameinfo error codes */
#define ARES_EBADFLAGS 18
/* ares_getaddrinfo error codes */
#define ARES_ENONAME 19
#define ARES_EBADHINTS 20
/* Uninitialized library error code */
#define ARES_ENOTINITIALIZED 21 /* introduced in 1.7.0 */
/* ares_library_init error codes */
#define ARES_ELOADIPHLPAPI 22 /* introduced in 1.7.0 */
#define ARES_EADDRGETNETWORKPARAMS 23 /* introduced in 1.7.0 */
/* More error codes */
#define ARES_ECANCELLED 24 /* introduced in 1.7.0 */
/* Flag values */
#define ARES_FLAG_USEVC (1 << 0)
#define ARES_FLAG_PRIMARY (1 << 1)
#define ARES_FLAG_IGNTC (1 << 2)
#define ARES_FLAG_NORECURSE (1 << 3)
#define ARES_FLAG_STAYOPEN (1 << 4)
#define ARES_FLAG_NOSEARCH (1 << 5)
#define ARES_FLAG_NOALIASES (1 << 6)
#define ARES_FLAG_NOCHECKRESP (1 << 7)
/* Option mask values */
#define ARES_OPT_FLAGS (1 << 0)
#define ARES_OPT_TIMEOUT (1 << 1)
#define ARES_OPT_TRIES (1 << 2)
#define ARES_OPT_NDOTS (1 << 3)
#define ARES_OPT_UDP_PORT (1 << 4)
#define ARES_OPT_TCP_PORT (1 << 5)
#define ARES_OPT_SERVERS (1 << 6)
#define ARES_OPT_DOMAINS (1 << 7)
#define ARES_OPT_LOOKUPS (1 << 8)
#define ARES_OPT_SOCK_STATE_CB (1 << 9)
#define ARES_OPT_SORTLIST (1 << 10)
#define ARES_OPT_SOCK_SNDBUF (1 << 11)
#define ARES_OPT_SOCK_RCVBUF (1 << 12)
#define ARES_OPT_TIMEOUTMS (1 << 13)
#define ARES_OPT_ROTATE (1 << 14)
/* Nameinfo flag values */
#define ARES_NI_NOFQDN (1 << 0)
#define ARES_NI_NUMERICHOST (1 << 1)
#define ARES_NI_NAMEREQD (1 << 2)
#define ARES_NI_NUMERICSERV (1 << 3)
#define ARES_NI_DGRAM (1 << 4)
#define ARES_NI_TCP 0
#define ARES_NI_UDP ARES_NI_DGRAM
#define ARES_NI_SCTP (1 << 5)
#define ARES_NI_DCCP (1 << 6)
#define ARES_NI_NUMERICSCOPE (1 << 7)
#define ARES_NI_LOOKUPHOST (1 << 8)
#define ARES_NI_LOOKUPSERVICE (1 << 9)
/* Reserved for future use */
#define ARES_NI_IDN (1 << 10)
#define ARES_NI_IDN_ALLOW_UNASSIGNED (1 << 11)
#define ARES_NI_IDN_USE_STD3_ASCII_RULES (1 << 12)
/* Addrinfo flag values */
#define ARES_AI_CANONNAME (1 << 0)
#define ARES_AI_NUMERICHOST (1 << 1)
#define ARES_AI_PASSIVE (1 << 2)
#define ARES_AI_NUMERICSERV (1 << 3)
#define ARES_AI_V4MAPPED (1 << 4)
#define ARES_AI_ALL (1 << 5)
#define ARES_AI_ADDRCONFIG (1 << 6)
/* Reserved for future use */
#define ARES_AI_IDN (1 << 10)
#define ARES_AI_IDN_ALLOW_UNASSIGNED (1 << 11)
#define ARES_AI_IDN_USE_STD3_ASCII_RULES (1 << 12)
#define ARES_AI_CANONIDN (1 << 13)
#define ARES_AI_MASK (ARES_AI_CANONNAME|ARES_AI_NUMERICHOST|ARES_AI_PASSIVE| \
ARES_AI_NUMERICSERV|ARES_AI_V4MAPPED|ARES_AI_ALL| \
ARES_AI_ADDRCONFIG)
#define ARES_GETSOCK_MAXNUM 16 /* ares_getsock() can return info about this
many sockets */
#define ARES_GETSOCK_READABLE(bits,num) (bits & (1<< (num)))
#define ARES_GETSOCK_WRITABLE(bits,num) (bits & (1 << ((num) + \
ARES_GETSOCK_MAXNUM)))
/* c-ares library initialization flag values */
#define ARES_LIB_INIT_NONE (0)
#define ARES_LIB_INIT_WIN32 (1 << 0)
#define ARES_LIB_INIT_ALL (ARES_LIB_INIT_WIN32)
/*
* Typedef our socket type
*/
#ifndef ares_socket_typedef
#ifdef WIN32
typedef SOCKET ares_socket_t;
#define ARES_SOCKET_BAD INVALID_SOCKET
#else
typedef int ares_socket_t;
#define ARES_SOCKET_BAD -1
#endif
#define ares_socket_typedef
#endif /* ares_socket_typedef */
typedef void (*ares_sock_state_cb)(void *data,
ares_socket_t socket_fd,
int readable,
int writable);
struct apattern;
/* NOTE about the ares_options struct to users and developers.
This struct will remain looking like this. It will not be extended nor
shrunk in future releases, but all new options will be set by ares_set_*()
options instead of with the ares_init_options() function.
Eventually (in a galaxy far far away), all options will be settable by
ares_set_*() options and the ares_init_options() function will become
deprecated.
When new options are added to c-ares, they are not added to this
struct. And they are not "saved" with the ares_save_options() function but
instead we encourage the use of the ares_dup() function. Needless to say,
if you add config options to c-ares you need to make sure ares_dup()
duplicates this new option.
*/
struct ares_options {
int flags;
int timeout; /* in seconds or milliseconds, depending on options */
int tries;
int ndots;
unsigned short udp_port;
unsigned short tcp_port;
int socket_send_buffer_size;
int socket_receive_buffer_size;
struct in_addr *servers;
int nservers;
char **domains;
int ndomains;
char *lookups;
ares_sock_state_cb sock_state_cb;
void *sock_state_cb_data;
struct apattern *sortlist;
int nsort;
};
struct hostent;
struct timeval;
struct sockaddr;
struct ares_channeldata;
typedef struct ares_channeldata *ares_channel;
typedef void (*ares_callback)(void *arg,
int status,
int timeouts,
unsigned char *abuf,
int alen);
typedef void (*ares_host_callback)(void *arg,
int status,
int timeouts,
struct hostent *hostent);
typedef void (*ares_nameinfo_callback)(void *arg,
int status,
int timeouts,
char *node,
char *service);
typedef int (*ares_sock_create_callback)(ares_socket_t socket_fd,
int type,
void *data);
CARES_EXTERN int ares_library_init(int flags);
CARES_EXTERN void ares_library_cleanup(void);
CARES_EXTERN const char *ares_version(int *version);
CARES_EXTERN int ares_init(ares_channel *channelptr);
CARES_EXTERN int ares_init_options(ares_channel *channelptr,
struct ares_options *options,
int optmask);
CARES_EXTERN int ares_save_options(ares_channel channel,
struct ares_options *options,
int *optmask);
CARES_EXTERN void ares_destroy_options(struct ares_options *options);
CARES_EXTERN int ares_dup(ares_channel *dest,
ares_channel src);
CARES_EXTERN void ares_destroy(ares_channel channel);
CARES_EXTERN void ares_cancel(ares_channel channel);
/* These next 3 configure local binding for the out-going socket
* connection. Use these to specify source IP and/or network device
* on multi-homed systems.
*/
CARES_EXTERN void ares_set_local_ip4(ares_channel channel, unsigned int local_ip);
/* local_ip6 should be 16 bytes in length */
CARES_EXTERN void ares_set_local_ip6(ares_channel channel,
const unsigned char* local_ip6);
/* local_dev_name should be null terminated. */
CARES_EXTERN void ares_set_local_dev(ares_channel channel,
const char* local_dev_name);
CARES_EXTERN void ares_set_socket_callback(ares_channel channel,
ares_sock_create_callback callback,
void *user_data);
CARES_EXTERN void ares_send(ares_channel channel,
const unsigned char *qbuf,
int qlen,
ares_callback callback,
void *arg);
CARES_EXTERN void ares_query(ares_channel channel,
const char *name,
int dnsclass,
int type,
ares_callback callback,
void *arg);
CARES_EXTERN void ares_search(ares_channel channel,
const char *name,
int dnsclass,
int type,
ares_callback callback,
void *arg);
CARES_EXTERN void ares_gethostbyname(ares_channel channel,
const char *name,
int family,
ares_host_callback callback,
void *arg);
CARES_EXTERN int ares_gethostbyname_file(ares_channel channel,
const char *name,
int family,
struct hostent **host);
CARES_EXTERN void ares_gethostbyaddr(ares_channel channel,
const void *addr,
int addrlen,
int family,
ares_host_callback callback,
void *arg);
CARES_EXTERN void ares_getnameinfo(ares_channel channel,
const struct sockaddr *sa,
ares_socklen_t salen,
int flags,
ares_nameinfo_callback callback,
void *arg);
CARES_EXTERN int ares_fds(ares_channel channel,
fd_set *read_fds,
fd_set *write_fds);
CARES_EXTERN int ares_getsock(ares_channel channel,
ares_socket_t *socks,
int numsocks);
CARES_EXTERN struct timeval *ares_timeout(ares_channel channel,
struct timeval *maxtv,
struct timeval *tv);
CARES_EXTERN void ares_process(ares_channel channel,
fd_set *read_fds,
fd_set *write_fds);
CARES_EXTERN void ares_process_fd(ares_channel channel,
ares_socket_t read_fd,
ares_socket_t write_fd);
CARES_EXTERN int ares_mkquery(const char *name,
int dnsclass,
int type,
unsigned short id,
int rd,
unsigned char **buf,
int *buflen);
CARES_EXTERN int ares_expand_name(const unsigned char *encoded,
const unsigned char *abuf,
int alen,
char **s,
long *enclen);
CARES_EXTERN int ares_expand_string(const unsigned char *encoded,
const unsigned char *abuf,
int alen,
unsigned char **s,
long *enclen);
/*
* NOTE: before c-ares 1.7.0 we would most often use the system in6_addr
* struct below when ares itself was built, but many apps would use this
* private version since the header checked a HAVE_* define for it. Starting
* with 1.7.0 we always declare and use our own to stop relying on the
* system's one.
*/
struct ares_in6_addr {
union {
unsigned char _S6_u8[16];
} _S6_un;
};
struct ares_addrttl {
struct in_addr ipaddr;
int ttl;
};
struct ares_addr6ttl {
struct ares_in6_addr ip6addr;
int ttl;
};
struct ares_srv_reply {
struct ares_srv_reply *next;
char *host;
unsigned short priority;
unsigned short weight;
unsigned short port;
};
struct ares_mx_reply {
struct ares_mx_reply *next;
char *host;
unsigned short priority;
};
struct ares_txt_reply {
struct ares_txt_reply *next;
unsigned char *txt;
size_t length; /* length excludes null termination */
};
/*
** Parse the buffer, starting at *abuf and of length alen bytes, previously
** obtained from an ares_search call. Put the results in *host, if nonnull.
** Also, if addrttls is nonnull, put up to *naddrttls IPv4 addresses along with
** their TTLs in that array, and set *naddrttls to the number of addresses
** so written.
*/
CARES_EXTERN int ares_parse_a_reply(const unsigned char *abuf,
int alen,
struct hostent **host,
struct ares_addrttl *addrttls,
int *naddrttls);
CARES_EXTERN int ares_parse_aaaa_reply(const unsigned char *abuf,
int alen,
struct hostent **host,
struct ares_addr6ttl *addrttls,
int *naddrttls);
CARES_EXTERN int ares_parse_ptr_reply(const unsigned char *abuf,
int alen,
const void *addr,
int addrlen,
int family,
struct hostent **host);
CARES_EXTERN int ares_parse_ns_reply(const unsigned char *abuf,
int alen,
struct hostent **host);
CARES_EXTERN int ares_parse_srv_reply(const unsigned char* abuf,
int alen,
struct ares_srv_reply** srv_out);
CARES_EXTERN int ares_parse_mx_reply(const unsigned char* abuf,
int alen,
struct ares_mx_reply** mx_out);
CARES_EXTERN int ares_parse_txt_reply(const unsigned char* abuf,
int alen,
struct ares_txt_reply** txt_out);
CARES_EXTERN void ares_free_string(void *str);
CARES_EXTERN void ares_free_hostent(struct hostent *host);
CARES_EXTERN void ares_free_data(void *dataptr);
CARES_EXTERN const char *ares_strerror(int code);
/* TODO: Hold port here as well. */
struct ares_addr_node {
struct ares_addr_node *next;
int family;
union {
struct in_addr addr4;
struct ares_in6_addr addr6;
} addr;
};
CARES_EXTERN int ares_set_servers(ares_channel channel,
struct ares_addr_node *servers);
/* Incomming string format: host[:port][,host[:port]]... */
CARES_EXTERN int ares_set_servers_csv(ares_channel channel,
const char* servers);
CARES_EXTERN int ares_get_servers(ares_channel channel,
struct ares_addr_node **servers);
#ifdef __cplusplus
}
#endif
#endif /* ARES__H */

66
deps/c-ares/ares__close_sockets.c vendored Normal file
View File

@@ -0,0 +1,66 @@
/* Copyright 1998 by the Massachusetts Institute of Technology.
*
* Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without
* fee is hereby granted, provided that the above copyright
* notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting
* documentation, and that the name of M.I.T. not be used in
* advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is"
* without express or implied warranty.
*/
#include "ares_setup.h"
#include <stdlib.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include "ares.h"
#include "ares_private.h"
void ares__close_sockets(ares_channel channel, struct server_state *server)
{
struct send_request *sendreq;
/* Free all pending output buffers. */
while (server->qhead)
{
/* Advance server->qhead; pull out query as we go. */
sendreq = server->qhead;
server->qhead = sendreq->next;
if (sendreq->data_storage != NULL)
free(sendreq->data_storage);
free(sendreq);
}
server->qtail = NULL;
/* Reset any existing input buffer. */
if (server->tcp_buffer)
free(server->tcp_buffer);
server->tcp_buffer = NULL;
server->tcp_lenbuf_pos = 0;
/* Reset brokenness */
server->is_broken = 0;
/* Close the TCP and UDP sockets. */
if (server->tcp_socket != ARES_SOCKET_BAD)
{
SOCK_STATE_CALLBACK(channel, server->tcp_socket, 0, 0);
sclose(server->tcp_socket);
server->tcp_socket = ARES_SOCKET_BAD;
server->tcp_connection_generation = ++channel->tcp_connection_generation;
}
if (server->udp_socket != ARES_SOCKET_BAD)
{
SOCK_STATE_CALLBACK(channel, server->udp_socket, 0, 0);
sclose(server->udp_socket);
server->udp_socket = ARES_SOCKET_BAD;
}
}

263
deps/c-ares/ares__get_hostent.c vendored Normal file
View File

@@ -0,0 +1,263 @@
/* Copyright 1998, 2010 by the Massachusetts Institute of Technology.
*
* Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without
* fee is hereby granted, provided that the above copyright
* notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting
* documentation, and that the name of M.I.T. not be used in
* advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is"
* without express or implied warranty.
*/
#include "ares_setup.h"
#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
#ifdef HAVE_NETDB_H
# include <netdb.h>
#endif
#ifdef HAVE_ARPA_INET_H
# include <arpa/inet.h>
#endif
#include "ares.h"
#include "inet_net_pton.h"
#include "ares_private.h"
int ares__get_hostent(FILE *fp, int family, struct hostent **host)
{
char *line = NULL, *p, *q, **alias;
char *txtaddr, *txthost, *txtalias;
int status;
size_t addrlen, linesize, naliases;
struct ares_addr addr;
struct hostent *hostent = NULL;
*host = NULL; /* Assume failure */
/* Validate family */
switch (family) {
case AF_INET:
case AF_INET6:
case AF_UNSPEC:
break;
default:
return ARES_EBADFAMILY;
}
while ((status = ares__read_line(fp, &line, &linesize)) == ARES_SUCCESS)
{
/* Trim line comment. */
p = line;
while (*p && (*p != '#'))
p++;
*p = '\0';
/* Trim trailing whitespace. */
q = p - 1;
while ((q >= line) && ISSPACE(*q))
q--;
*++q = '\0';
/* Skip leading whitespace. */
p = line;
while (*p && ISSPACE(*p))
p++;
if (!*p)
/* Ignore line if empty. */
continue;
/* Pointer to start of IPv4 or IPv6 address part. */
txtaddr = p;
/* Advance past address part. */
while (*p && !ISSPACE(*p))
p++;
if (!*p)
/* Ignore line if reached end of line. */
continue;
/* Null terminate address part. */
*p = '\0';
/* Advance to host name */
p++;
while (*p && ISSPACE(*p))
p++;
if (!*p)
/* Ignore line if reached end of line. */
continue;
/* Pointer to start of host name. */
txthost = p;
/* Advance past host name. */
while (*p && !ISSPACE(*p))
p++;
/* Pointer to start of first alias. */
txtalias = NULL;
if (*p)
{
q = p + 1;
while (*q && ISSPACE(*q))
q++;
if (*q)
txtalias = q;
}
/* Null terminate host name. */
*p = '\0';
/* find out number of aliases. */
naliases = 0;
if (txtalias)
{
p = txtalias;
while (*p)
{
while (*p && !ISSPACE(*p))
p++;
while (*p && ISSPACE(*p))
p++;
naliases++;
}
}
/* Convert address string to network address for the requested family. */
addrlen = 0;
addr.family = AF_UNSPEC;
addr.addrV4.s_addr = INADDR_NONE;
if ((family == AF_INET) || (family == AF_UNSPEC))
{
addr.addrV4.s_addr = inet_addr(txtaddr);
if (addr.addrV4.s_addr != INADDR_NONE)
{
/* Actual network address family and length. */
addr.family = AF_INET;
addrlen = sizeof(addr.addrV4);
}
}
if ((family == AF_INET6) || ((family == AF_UNSPEC) && (!addrlen)))
{
if (ares_inet_pton(AF_INET6, txtaddr, &addr.addrV6) > 0)
{
/* Actual network address family and length. */
addr.family = AF_INET6;
addrlen = sizeof(addr.addrV6);
}
}
if (!addrlen)
/* Ignore line if invalid address string for the requested family. */
continue;
/*
** Actual address family possible values are AF_INET and AF_INET6 only.
*/
/* Allocate memory for the hostent structure. */
hostent = malloc(sizeof(struct hostent));
if (!hostent)
break;
/* Initialize fields for out of memory condition. */
hostent->h_aliases = NULL;
hostent->h_addr_list = NULL;
/* Copy official host name. */
hostent->h_name = strdup(txthost);
if (!hostent->h_name)
break;
/* Copy network address. */
hostent->h_addr_list = malloc(2 * sizeof(char *));
if (!hostent->h_addr_list)
break;
hostent->h_addr_list[1] = NULL;
hostent->h_addr_list[0] = malloc(addrlen);
if (!hostent->h_addr_list[0])
break;
if (addr.family == AF_INET)
memcpy(hostent->h_addr_list[0], &addr.addrV4, sizeof(addr.addrV4));
else
memcpy(hostent->h_addr_list[0], &addr.addrV6, sizeof(addr.addrV6));
/* Copy aliases. */
hostent->h_aliases = malloc((naliases + 1) * sizeof(char *));
if (!hostent->h_aliases)
break;
alias = hostent->h_aliases;
while (naliases)
*(alias + naliases--) = NULL;
*alias = NULL;
while (txtalias)
{
p = txtalias;
while (*p && !ISSPACE(*p))
p++;
q = p;
while (*q && ISSPACE(*q))
q++;
*p = '\0';
if ((*alias = strdup(txtalias)) == NULL)
break;
alias++;
txtalias = *q ? q : NULL;
}
if (txtalias)
/* Alias memory allocation failure. */
break;
/* Copy actual network address family and length. */
hostent->h_addrtype = addr.family;
hostent->h_length = (int)addrlen;
/* Free line buffer. */
free(line);
/* Return hostent successfully */
*host = hostent;
return ARES_SUCCESS;
}
/* If allocated, free line buffer. */
if (line)
free(line);
if (status == ARES_SUCCESS)
{
/* Memory allocation failure; clean up. */
if (hostent)
{
if (hostent->h_name)
free((char *) hostent->h_name);
if (hostent->h_aliases)
{
for (alias = hostent->h_aliases; *alias; alias++)
free(*alias);
free(hostent->h_aliases);
}
if (hostent->h_addr_list)
{
if (hostent->h_addr_list[0])
free(hostent->h_addr_list[0]);
free(hostent->h_addr_list);
}
free(hostent);
}
return ARES_ENOMEM;
}
return status;
}

71
deps/c-ares/ares__read_line.c vendored Normal file
View File

@@ -0,0 +1,71 @@
/* Copyright 1998 by the Massachusetts Institute of Technology.
*
* Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without
* fee is hereby granted, provided that the above copyright
* notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting
* documentation, and that the name of M.I.T. not be used in
* advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is"
* without express or implied warranty.
*/
#include "ares_setup.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "ares.h"
#include "ares_nowarn.h"
#include "ares_private.h"
/* This is an internal function. Its contract is to read a line from
* a file into a dynamically allocated buffer, zeroing the trailing
* newline if there is one. The calling routine may call
* ares__read_line multiple times with the same buf and bufsize
* pointers; *buf will be reallocated and *bufsize adjusted as
* appropriate. The initial value of *buf should be NULL. After the
* calling routine is done reading lines, it should free *buf.
*/
int ares__read_line(FILE *fp, char **buf, size_t *bufsize)
{
char *newbuf;
size_t offset = 0;
size_t len;
if (*buf == NULL)
{
*buf = malloc(128);
if (!*buf)
return ARES_ENOMEM;
*bufsize = 128;
}
for (;;)
{
int bytestoread = aresx_uztosi(*bufsize - offset);
if (!fgets(*buf + offset, bytestoread, fp))
return (offset != 0) ? 0 : (ferror(fp)) ? ARES_EFILE : ARES_EOF;
len = offset + strlen(*buf + offset);
if ((*buf)[len - 1] == '\n')
{
(*buf)[len - 1] = 0;
break;
}
offset = len;
if(len < *bufsize - 1)
continue;
/* Allocate more space. */
newbuf = realloc(*buf, *bufsize * 2);
if (!newbuf)
return ARES_ENOMEM;
*buf = newbuf;
*bufsize *= 2;
}
return ARES_SUCCESS;
}

111
deps/c-ares/ares__timeval.c vendored Normal file
View File

@@ -0,0 +1,111 @@
/* Copyright (C) 2008 by Daniel Stenberg et al
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted, provided
* that the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of M.I.T. not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. M.I.T. makes no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*/
#include "ares_setup.h"
#include "ares.h"
#include "ares_private.h"
#if defined(WIN32) && !defined(MSDOS)
struct timeval ares__tvnow(void)
{
/*
** GetTickCount() is available on _all_ Windows versions from W95 up
** to nowadays. Returns milliseconds elapsed since last system boot,
** increases monotonically and wraps once 49.7 days have elapsed.
*/
struct timeval now;
DWORD milliseconds = GetTickCount();
now.tv_sec = milliseconds / 1000;
now.tv_usec = (milliseconds % 1000) * 1000;
return now;
}
#elif defined(HAVE_CLOCK_GETTIME_MONOTONIC)
struct timeval ares__tvnow(void)
{
/*
** clock_gettime() is granted to be increased monotonically when the
** monotonic clock is queried. Time starting point is unspecified, it
** could be the system start-up time, the Epoch, or something else,
** in any case the time starting point does not change once that the
** system has started up.
*/
struct timeval now;
struct timespec tsnow;
if(0 == clock_gettime(CLOCK_MONOTONIC, &tsnow)) {
now.tv_sec = tsnow.tv_sec;
now.tv_usec = tsnow.tv_nsec / 1000;
}
/*
** Even when the configure process has truly detected monotonic clock
** availability, it might happen that it is not actually available at
** run-time. When this occurs simply fallback to other time source.
*/
#ifdef HAVE_GETTIMEOFDAY
else
(void)gettimeofday(&now, NULL);
#else
else {
now.tv_sec = (long)time(NULL);
now.tv_usec = 0;
}
#endif
return now;
}
#elif defined(HAVE_GETTIMEOFDAY)
struct timeval ares__tvnow(void)
{
/*
** gettimeofday() is not granted to be increased monotonically, due to
** clock drifting and external source time synchronization it can jump
** forward or backward in time.
*/
struct timeval now;
(void)gettimeofday(&now, NULL);
return now;
}
#else
struct timeval ares__tvnow(void)
{
/*
** time() returns the value of time in seconds since the Epoch.
*/
struct timeval now;
now.tv_sec = (long)time(NULL);
now.tv_usec = 0;
return now;
}
#endif
#if 0 /* Not used */
/*
* Make sure that the first argument is the more recent time, as otherwise
* we'll get a weird negative time-diff back...
*
* Returns: the time difference in number of milliseconds.
*/
long ares__tvdiff(struct timeval newer, struct timeval older)
{
return (newer.tv_sec-older.tv_sec)*1000+
(newer.tv_usec-older.tv_usec)/1000;
}
#endif

63
deps/c-ares/ares_cancel.c vendored Normal file
View File

@@ -0,0 +1,63 @@
/* Copyright (C) 2004 by Daniel Stenberg et al
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted, provided
* that the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of M.I.T. not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. M.I.T. makes no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*/
#include "ares_setup.h"
#include <assert.h>
#include <stdlib.h>
#include "ares.h"
#include "ares_private.h"
/*
* ares_cancel() cancels all ongoing requests/resolves that might be going on
* on the given channel. It does NOT kill the channel, use ares_destroy() for
* that.
*/
void ares_cancel(ares_channel channel)
{
struct query *query;
struct list_node* list_head;
struct list_node* list_node;
int i;
list_head = &(channel->all_queries);
for (list_node = list_head->next; list_node != list_head; )
{
query = list_node->data;
list_node = list_node->next; /* since we're deleting the query */
query->callback(query->arg, ARES_ECANCELLED, 0, NULL, 0);
ares__free_query(query);
}
#ifndef NDEBUG
/* Freeing the query should remove it from all the lists in which it sits,
* so all query lists should be empty now.
*/
assert(ares__is_list_empty(&(channel->all_queries)));
for (i = 0; i < ARES_QID_TABLE_SIZE; i++)
{
assert(ares__is_list_empty(&(channel->queries_by_qid[i])));
}
for (i = 0; i < ARES_TIMEOUT_TABLE_SIZE; i++)
{
assert(ares__is_list_empty(&(channel->queries_by_timeout[i])));
}
#endif
if (!(channel->flags & ARES_FLAG_STAYOPEN))
{
if (channel->servers)
{
for (i = 0; i < channel->nservers; i++)
ares__close_sockets(channel, &channel->servers[i]);
}
}
}

190
deps/c-ares/ares_data.c vendored Normal file
View File

@@ -0,0 +1,190 @@
/* Copyright (C) 2009-2010 by Daniel Stenberg
*
* Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without
* fee is hereby granted, provided that the above copyright
* notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting
* documentation, and that the name of M.I.T. not be used in
* advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is"
* without express or implied warranty.
*/
#include "ares_setup.h"
#include <stddef.h>
#include "ares.h"
#include "ares_data.h"
#include "ares_private.h"
/*
** ares_free_data() - c-ares external API function.
**
** This function must be used by the application to free data memory that
** has been internally allocated by some c-ares function and for which a
** pointer has already been returned to the calling application. The list
** of c-ares functions returning pointers that must be free'ed using this
** function is:
**
** ares_get_servers()
** ares_parse_srv_reply()
** ares_parse_txt_reply()
*/
void ares_free_data(void *dataptr)
{
struct ares_data *ptr;
if (!dataptr)
return;
#ifdef __INTEL_COMPILER
# pragma warning(push)
# pragma warning(disable:1684)
/* 1684: conversion from pointer to same-sized integral type */
#endif
ptr = (void *)((char *)dataptr - offsetof(struct ares_data, data));
#ifdef __INTEL_COMPILER
# pragma warning(pop)
#endif
if (ptr->mark != ARES_DATATYPE_MARK)
return;
switch (ptr->type)
{
case ARES_DATATYPE_MX_REPLY:
if (ptr->data.mx_reply.next)
ares_free_data(ptr->data.mx_reply.next);
if (ptr->data.mx_reply.host)
free(ptr->data.mx_reply.host);
break;
case ARES_DATATYPE_SRV_REPLY:
if (ptr->data.srv_reply.next)
ares_free_data(ptr->data.srv_reply.next);
if (ptr->data.srv_reply.host)
free(ptr->data.srv_reply.host);
break;
case ARES_DATATYPE_TXT_REPLY:
if (ptr->data.txt_reply.next)
ares_free_data(ptr->data.txt_reply.next);
if (ptr->data.txt_reply.txt)
free(ptr->data.txt_reply.txt);
break;
case ARES_DATATYPE_ADDR_NODE:
if (ptr->data.addr_node.next)
ares_free_data(ptr->data.addr_node.next);
break;
default:
return;
}
free(ptr);
}
/*
** ares_malloc_data() - c-ares internal helper function.
**
** This function allocates memory for a c-ares private ares_data struct
** for the specified ares_datatype, initializes c-ares private fields
** and zero initializes those which later might be used from the public
** API. It returns an interior pointer which can be passed by c-ares
** functions to the calling application, and that must be free'ed using
** c-ares external API function ares_free_data().
*/
void *ares_malloc_data(ares_datatype type)
{
struct ares_data *ptr;
ptr = malloc(sizeof(struct ares_data));
if (!ptr)
return NULL;
switch (type)
{
case ARES_DATATYPE_MX_REPLY:
ptr->data.mx_reply.next = NULL;
ptr->data.mx_reply.host = NULL;
ptr->data.mx_reply.priority = 0;
break;
case ARES_DATATYPE_SRV_REPLY:
ptr->data.srv_reply.next = NULL;
ptr->data.srv_reply.host = NULL;
ptr->data.srv_reply.priority = 0;
ptr->data.srv_reply.weight = 0;
ptr->data.srv_reply.port = 0;
break;
case ARES_DATATYPE_TXT_REPLY:
ptr->data.txt_reply.next = NULL;
ptr->data.txt_reply.txt = NULL;
ptr->data.txt_reply.length = 0;
break;
case ARES_DATATYPE_ADDR_NODE:
ptr->data.addr_node.next = NULL;
ptr->data.addr_node.family = 0;
memset(&ptr->data.addr_node.addrV6, 0,
sizeof(ptr->data.addr_node.addrV6));
break;
default:
free(ptr);
return NULL;
}
ptr->mark = ARES_DATATYPE_MARK;
ptr->type = type;
return &ptr->data;
}
/*
** ares_get_datatype() - c-ares internal helper function.
**
** This function returns the ares_datatype of the data stored in a
** private ares_data struct when given the public API pointer.
*/
ares_datatype ares_get_datatype(void * dataptr)
{
struct ares_data *ptr;
#ifdef __INTEL_COMPILER
# pragma warning(push)
# pragma warning(disable:1684)
/* 1684: conversion from pointer to same-sized integral type */
#endif
ptr = (void *)((char *)dataptr - offsetof(struct ares_data, data));
#ifdef __INTEL_COMPILER
# pragma warning(pop)
#endif
if (ptr->mark == ARES_DATATYPE_MARK)
return ptr->type;
return ARES_DATATYPE_UNKNOWN;
}

65
deps/c-ares/ares_data.h vendored Normal file
View File

@@ -0,0 +1,65 @@
/* Copyright (C) 2009-2010 by Daniel Stenberg
*
* Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without
* fee is hereby granted, provided that the above copyright
* notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting
* documentation, and that the name of M.I.T. not be used in
* advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is"
* without express or implied warranty.
*/
typedef enum {
ARES_DATATYPE_UNKNOWN = 1, /* unknown data type - introduced in 1.7.0 */
ARES_DATATYPE_SRV_REPLY, /* struct ares_srv_reply - introduced in 1.7.0 */
ARES_DATATYPE_TXT_REPLY, /* struct ares_txt_reply - introduced in 1.7.0 */
ARES_DATATYPE_ADDR_NODE, /* struct ares_addr_node - introduced in 1.7.1 */
ARES_DATATYPE_MX_REPLY, /* struct ares_mx_reply - introduced in 1.7.2 */
#if 0
ARES_DATATYPE_ADDR6TTL, /* struct ares_addrttl */
ARES_DATATYPE_ADDRTTL, /* struct ares_addr6ttl */
ARES_DATATYPE_HOSTENT, /* struct hostent */
ARES_DATATYPE_OPTIONS, /* struct ares_options */
#endif
ARES_DATATYPE_LAST /* not used - introduced in 1.7.0 */
} ares_datatype;
#define ARES_DATATYPE_MARK 0xbead
/*
* ares_data struct definition is internal to c-ares and shall not
* be exposed by the public API in order to allow future changes
* and extensions to it without breaking ABI. This will be used
* internally by c-ares as the container of multiple types of data
* dynamically allocated for which a reference will be returned
* to the calling application.
*
* c-ares API functions returning a pointer to c-ares internally
* allocated data will actually be returning an interior pointer
* into this ares_data struct.
*
* All this is 'invisible' to the calling application, the only
* requirement is that this kind of data must be free'ed by the
* calling application using ares_free_data() with the pointer
* it has received from a previous c-ares function call.
*/
struct ares_data {
ares_datatype type; /* Actual data type identifier. */
unsigned int mark; /* Private ares_data signature. */
union {
struct ares_txt_reply txt_reply;
struct ares_srv_reply srv_reply;
struct ares_addr_node addr_node;
struct ares_mx_reply mx_reply;
} data;
};
void *ares_malloc_data(ares_datatype type);
ares_datatype ares_get_datatype(void * dataptr);

105
deps/c-ares/ares_destroy.c vendored Normal file
View File

@@ -0,0 +1,105 @@
/* Copyright 1998 by the Massachusetts Institute of Technology.
* Copyright (C) 2004-2010 by Daniel Stenberg
*
* Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without
* fee is hereby granted, provided that the above copyright
* notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting
* documentation, and that the name of M.I.T. not be used in
* advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is"
* without express or implied warranty.
*/
#include "ares_setup.h"
#include <assert.h>
#include <stdlib.h>
#include "ares.h"
#include "ares_private.h"
void ares_destroy_options(struct ares_options *options)
{
int i;
if(options->servers)
free(options->servers);
for (i = 0; i < options->ndomains; i++)
free(options->domains[i]);
free(options->domains);
if(options->sortlist)
free(options->sortlist);
free(options->lookups);
}
void ares_destroy(ares_channel channel)
{
int i;
struct query *query;
struct list_node* list_head;
struct list_node* list_node;
if (!channel)
return;
list_head = &(channel->all_queries);
for (list_node = list_head->next; list_node != list_head; )
{
query = list_node->data;
list_node = list_node->next; /* since we're deleting the query */
query->callback(query->arg, ARES_EDESTRUCTION, 0, NULL, 0);
ares__free_query(query);
}
#ifndef NDEBUG
/* Freeing the query should remove it from all the lists in which it sits,
* so all query lists should be empty now.
*/
assert(ares__is_list_empty(&(channel->all_queries)));
for (i = 0; i < ARES_QID_TABLE_SIZE; i++)
{
assert(ares__is_list_empty(&(channel->queries_by_qid[i])));
}
for (i = 0; i < ARES_TIMEOUT_TABLE_SIZE; i++)
{
assert(ares__is_list_empty(&(channel->queries_by_timeout[i])));
}
#endif
ares__destroy_servers_state(channel);
if (channel->domains) {
for (i = 0; i < channel->ndomains; i++)
free(channel->domains[i]);
free(channel->domains);
}
if(channel->sortlist)
free(channel->sortlist);
if (channel->lookups)
free(channel->lookups);
free(channel);
}
void ares__destroy_servers_state(ares_channel channel)
{
struct server_state *server;
int i;
if (channel->servers)
{
for (i = 0; i < channel->nservers; i++)
{
server = &channel->servers[i];
ares__close_sockets(channel, server);
assert(ares__is_list_empty(&server->queries_to_server));
}
free(channel->servers);
channel->servers = NULL;
}
channel->nservers = -1;
}

90
deps/c-ares/ares_dns.h vendored Normal file
View File

@@ -0,0 +1,90 @@
/* Copyright 1998 by the Massachusetts Institute of Technology.
*
* Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without
* fee is hereby granted, provided that the above copyright
* notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting
* documentation, and that the name of M.I.T. not be used in
* advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is"
* without express or implied warranty.
*/
#ifndef ARES__DNS_H
#define ARES__DNS_H
#define DNS__16BIT(p) (((p)[0] << 8) | (p)[1])
#define DNS__32BIT(p) (((p)[0] << 24) | ((p)[1] << 16) | \
((p)[2] << 8) | (p)[3])
#define DNS__SET16BIT(p, v) (((p)[0] = (unsigned char)(((v) >> 8) & 0xff)), \
((p)[1] = (unsigned char)((v) & 0xff)))
#define DNS__SET32BIT(p, v) (((p)[0] = (unsigned char)(((v) >> 24) & 0xff)), \
((p)[1] = (unsigned char)(((v) >> 16) & 0xff)), \
((p)[2] = (unsigned char)(((v) >> 8) & 0xff)), \
((p)[3] = (unsigned char)((v) & 0xff)))
#if 0
/* we cannot use this approach on systems where we can't access 16/32 bit
data on un-aligned addresses */
#define DNS__16BIT(p) ntohs(*(unsigned short*)(p))
#define DNS__32BIT(p) ntohl(*(unsigned long*)(p))
#define DNS__SET16BIT(p, v) *(unsigned short*)(p) = htons(v)
#define DNS__SET32BIT(p, v) *(unsigned long*)(p) = htonl(v)
#endif
/* Macros for parsing a DNS header */
#define DNS_HEADER_QID(h) DNS__16BIT(h)
#define DNS_HEADER_QR(h) (((h)[2] >> 7) & 0x1)
#define DNS_HEADER_OPCODE(h) (((h)[2] >> 3) & 0xf)
#define DNS_HEADER_AA(h) (((h)[2] >> 2) & 0x1)
#define DNS_HEADER_TC(h) (((h)[2] >> 1) & 0x1)
#define DNS_HEADER_RD(h) ((h)[2] & 0x1)
#define DNS_HEADER_RA(h) (((h)[3] >> 7) & 0x1)
#define DNS_HEADER_Z(h) (((h)[3] >> 4) & 0x7)
#define DNS_HEADER_RCODE(h) ((h)[3] & 0xf)
#define DNS_HEADER_QDCOUNT(h) DNS__16BIT((h) + 4)
#define DNS_HEADER_ANCOUNT(h) DNS__16BIT((h) + 6)
#define DNS_HEADER_NSCOUNT(h) DNS__16BIT((h) + 8)
#define DNS_HEADER_ARCOUNT(h) DNS__16BIT((h) + 10)
/* Macros for constructing a DNS header */
#define DNS_HEADER_SET_QID(h, v) DNS__SET16BIT(h, v)
#define DNS_HEADER_SET_QR(h, v) ((h)[2] |= (unsigned char)(((v) & 0x1) << 7))
#define DNS_HEADER_SET_OPCODE(h, v) ((h)[2] |= (unsigned char)(((v) & 0xf) << 3))
#define DNS_HEADER_SET_AA(h, v) ((h)[2] |= (unsigned char)(((v) & 0x1) << 2))
#define DNS_HEADER_SET_TC(h, v) ((h)[2] |= (unsigned char)(((v) & 0x1) << 1))
#define DNS_HEADER_SET_RD(h, v) ((h)[2] |= (unsigned char)((v) & 0x1))
#define DNS_HEADER_SET_RA(h, v) ((h)[3] |= (unsigned char)(((v) & 0x1) << 7))
#define DNS_HEADER_SET_Z(h, v) ((h)[3] |= (unsigned char)(((v) & 0x7) << 4))
#define DNS_HEADER_SET_RCODE(h, v) ((h)[3] |= (unsigned char)((v) & 0xf))
#define DNS_HEADER_SET_QDCOUNT(h, v) DNS__SET16BIT((h) + 4, v)
#define DNS_HEADER_SET_ANCOUNT(h, v) DNS__SET16BIT((h) + 6, v)
#define DNS_HEADER_SET_NSCOUNT(h, v) DNS__SET16BIT((h) + 8, v)
#define DNS_HEADER_SET_ARCOUNT(h, v) DNS__SET16BIT((h) + 10, v)
/* Macros for parsing the fixed part of a DNS question */
#define DNS_QUESTION_TYPE(q) DNS__16BIT(q)
#define DNS_QUESTION_CLASS(q) DNS__16BIT((q) + 2)
/* Macros for constructing the fixed part of a DNS question */
#define DNS_QUESTION_SET_TYPE(q, v) DNS__SET16BIT(q, v)
#define DNS_QUESTION_SET_CLASS(q, v) DNS__SET16BIT((q) + 2, v)
/* Macros for parsing the fixed part of a DNS resource record */
#define DNS_RR_TYPE(r) DNS__16BIT(r)
#define DNS_RR_CLASS(r) DNS__16BIT((r) + 2)
#define DNS_RR_TTL(r) DNS__32BIT((r) + 4)
#define DNS_RR_LEN(r) DNS__16BIT((r) + 8)
/* Macros for constructing the fixed part of a DNS resource record */
#define DNS_RR_SET_TYPE(r) DNS__SET16BIT(r, v)
#define DNS_RR_SET_CLASS(r) DNS__SET16BIT((r) + 2, v)
#define DNS_RR_SET_TTL(r) DNS__SET32BIT((r) + 4, v)
#define DNS_RR_SET_LEN(r) DNS__SET16BIT((r) + 8, v)
#endif /* ARES__DNS_H */

193
deps/c-ares/ares_expand_name.c vendored Normal file
View File

@@ -0,0 +1,193 @@
/* Copyright 1998 by the Massachusetts Institute of Technology.
*
* Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without
* fee is hereby granted, provided that the above copyright
* notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting
* documentation, and that the name of M.I.T. not be used in
* advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is"
* without express or implied warranty.
*/
#include "ares_setup.h"
#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
#ifdef HAVE_ARPA_NAMESER_H
# include <arpa/nameser.h>
#else
# include "nameser.h"
#endif
#ifdef HAVE_ARPA_NAMESER_COMPAT_H
# include <arpa/nameser_compat.h>
#endif
#include <stdlib.h>
#include "ares.h"
#include "ares_private.h" /* for the memdebug */
static int name_length(const unsigned char *encoded, const unsigned char *abuf,
int alen);
/* Expand an RFC1035-encoded domain name given by encoded. The
* containing message is given by abuf and alen. The result given by
* *s, which is set to a NUL-terminated allocated buffer. *enclen is
* set to the length of the encoded name (not the length of the
* expanded name; the goal is to tell the caller how many bytes to
* move forward to get past the encoded name).
*
* In the simple case, an encoded name is a series of labels, each
* composed of a one-byte length (limited to values between 0 and 63
* inclusive) followed by the label contents. The name is terminated
* by a zero-length label.
*
* In the more complicated case, a label may be terminated by an
* indirection pointer, specified by two bytes with the high bits of
* the first byte (corresponding to INDIR_MASK) set to 11. With the
* two high bits of the first byte stripped off, the indirection
* pointer gives an offset from the beginning of the containing
* message with more labels to decode. Indirection can happen an
* arbitrary number of times, so we have to detect loops.
*
* Since the expanded name uses '.' as a label separator, we use
* backslashes to escape periods or backslashes in the expanded name.
*/
int ares_expand_name(const unsigned char *encoded, const unsigned char *abuf,
int alen, char **s, long *enclen)
{
int len, indir = 0;
char *q;
const unsigned char *p;
union {
ssize_t sig;
size_t uns;
} nlen;
nlen.sig = name_length(encoded, abuf, alen);
if (nlen.sig < 0)
return ARES_EBADNAME;
*s = malloc(nlen.uns + 1);
if (!*s)
return ARES_ENOMEM;
q = *s;
if (nlen.uns == 0) {
/* RFC2181 says this should be ".": the root of the DNS tree.
* Since this function strips trailing dots though, it becomes ""
*/
q[0] = '\0';
*enclen = 1; /* the caller should move one byte to get past this */
return ARES_SUCCESS;
}
/* No error-checking necessary; it was all done by name_length(). */
p = encoded;
while (*p)
{
if ((*p & INDIR_MASK) == INDIR_MASK)
{
if (!indir)
{
*enclen = p + 2 - encoded;
indir = 1;
}
p = abuf + ((*p & ~INDIR_MASK) << 8 | *(p + 1));
}
else
{
len = *p;
p++;
while (len--)
{
if (*p == '.' || *p == '\\')
*q++ = '\\';
*q++ = *p;
p++;
}
*q++ = '.';
}
}
if (!indir)
*enclen = p + 1 - encoded;
/* Nuke the trailing period if we wrote one. */
if (q > *s)
*(q - 1) = 0;
else
*q = 0; /* zero terminate */
return ARES_SUCCESS;
}
/* Return the length of the expansion of an encoded domain name, or
* -1 if the encoding is invalid.
*/
static int name_length(const unsigned char *encoded, const unsigned char *abuf,
int alen)
{
int n = 0, offset, indir = 0;
/* Allow the caller to pass us abuf + alen and have us check for it. */
if (encoded == abuf + alen)
return -1;
while (*encoded)
{
if ((*encoded & INDIR_MASK) == INDIR_MASK)
{
/* Check the offset and go there. */
if (encoded + 1 >= abuf + alen)
return -1;
offset = (*encoded & ~INDIR_MASK) << 8 | *(encoded + 1);
if (offset >= alen)
return -1;
encoded = abuf + offset;
/* If we've seen more indirects than the message length,
* then there's a loop.
*/
if (++indir > alen)
return -1;
}
else
{
offset = *encoded;
if (encoded + offset + 1 >= abuf + alen)
return -1;
encoded++;
while (offset--)
{
n += (*encoded == '.' || *encoded == '\\') ? 2 : 1;
encoded++;
}
n++;
}
}
/* If there were any labels at all, then the number of dots is one
* less than the number of labels, so subtract one.
*/
return (n) ? n - 1 : n;
}
/* Like ares_expand_name but returns EBADRESP in case of invalid input. */
int ares__expand_name_for_response(const unsigned char *encoded,
const unsigned char *abuf, int alen,
char **s, long *enclen)
{
int status = ares_expand_name(encoded, abuf, alen, s, enclen);
if (status == ARES_EBADNAME)
status = ARES_EBADRESP;
return status;
}

75
deps/c-ares/ares_expand_string.c vendored Normal file
View File

@@ -0,0 +1,75 @@
/* Copyright 1998 by the Massachusetts Institute of Technology.
*
* Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without
* fee is hereby granted, provided that the above copyright
* notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting
* documentation, and that the name of M.I.T. not be used in
* advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is"
* without express or implied warranty.
*/
#include "ares_setup.h"
#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
#ifdef HAVE_ARPA_NAMESER_H
# include <arpa/nameser.h>
#else
# include "nameser.h"
#endif
#include <string.h>
#include <stdlib.h>
#include "ares.h"
#include "ares_private.h" /* for the memdebug */
/* Simply decodes a length-encoded character string. The first byte of the
* input is the length of the string to be returned and the bytes thereafter
* are the characters of the string. The returned result will be NULL
* terminated.
*/
int ares_expand_string(const unsigned char *encoded,
const unsigned char *abuf,
int alen,
unsigned char **s,
long *enclen)
{
unsigned char *q;
union {
ssize_t sig;
size_t uns;
} elen;
if (encoded == abuf+alen)
return ARES_EBADSTR;
elen.uns = *encoded;
if (encoded+elen.sig+1 > abuf+alen)
return ARES_EBADSTR;
encoded++;
*s = malloc(elen.uns+1);
if (*s == NULL)
return ARES_ENOMEM;
q = *s;
strncpy((char *)q, (char *)encoded, elen.uns);
q[elen.uns] = '\0';
*s = q;
*enclen = (long)(elen.sig+1);
return ARES_SUCCESS;
}

62
deps/c-ares/ares_fds.c vendored Normal file
View File

@@ -0,0 +1,62 @@
/* Copyright 1998 by the Massachusetts Institute of Technology.
*
* Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without
* fee is hereby granted, provided that the above copyright
* notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting
* documentation, and that the name of M.I.T. not be used in
* advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is"
* without express or implied warranty.
*/
#include "ares_setup.h"
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#include "ares.h"
#include "ares_private.h"
int ares_fds(ares_channel channel, fd_set *read_fds, fd_set *write_fds)
{
struct server_state *server;
ares_socket_t nfds;
int i;
/* Are there any active queries? */
int active_queries = !ares__is_list_empty(&(channel->all_queries));
nfds = 0;
for (i = 0; i < channel->nservers; i++)
{
server = &channel->servers[i];
/* We only need to register interest in UDP sockets if we have
* outstanding queries.
*/
if (active_queries && server->udp_socket != ARES_SOCKET_BAD)
{
FD_SET(server->udp_socket, read_fds);
if (server->udp_socket >= nfds)
nfds = server->udp_socket + 1;
}
/* We always register for TCP events, because we want to know
* when the other side closes the connection, so we don't waste
* time trying to use a broken connection.
*/
if (server->tcp_socket != ARES_SOCKET_BAD)
{
FD_SET(server->tcp_socket, read_fds);
if (server->qhead)
FD_SET(server->tcp_socket, write_fds);
if (server->tcp_socket >= nfds)
nfds = server->tcp_socket + 1;
}
}
return (int)nfds;
}

39
deps/c-ares/ares_free_hostent.c vendored Normal file
View File

@@ -0,0 +1,39 @@
/* Copyright 1998 by the Massachusetts Institute of Technology.
*
* Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without
* fee is hereby granted, provided that the above copyright
* notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting
* documentation, and that the name of M.I.T. not be used in
* advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is"
* without express or implied warranty.
*/
#include "ares_setup.h"
#include <stdlib.h>
#ifdef HAVE_NETDB_H
#include <netdb.h>
#endif
#include "ares.h"
#include "ares_private.h" /* for memdebug */
void ares_free_hostent(struct hostent *host)
{
char **p;
free((char *)(host->h_name));
for (p = host->h_aliases; *p; p++)
free(*p);
free(host->h_aliases);
free(host->h_addr_list[0]); /* no matter if there is one or many entries,
there is only one malloc for all of them */
free(host->h_addr_list);
free(host);
}

25
deps/c-ares/ares_free_string.c vendored Normal file
View File

@@ -0,0 +1,25 @@
/* Copyright 2000 by the Massachusetts Institute of Technology.
*
* Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without
* fee is hereby granted, provided that the above copyright
* notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting
* documentation, and that the name of M.I.T. not be used in
* advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is"
* without express or implied warranty.
*/
#include "ares_setup.h"
#include <stdlib.h>
#include "ares.h"
#include "ares_private.h"
void ares_free_string(void *str)
{
free(str);
}

292
deps/c-ares/ares_gethostbyaddr.c vendored Normal file
View File

@@ -0,0 +1,292 @@
/* Copyright 1998 by the Massachusetts Institute of Technology.
*
* Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without
* fee is hereby granted, provided that the above copyright
* notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting
* documentation, and that the name of M.I.T. not be used in
* advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is"
* without express or implied warranty.
*/
#include "ares_setup.h"
#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
#ifdef HAVE_NETDB_H
# include <netdb.h>
#endif
#ifdef HAVE_ARPA_INET_H
# include <arpa/inet.h>
#endif
#ifdef HAVE_ARPA_NAMESER_H
# include <arpa/nameser.h>
#else
# include "nameser.h"
#endif
#ifdef HAVE_ARPA_NAMESER_COMPAT_H
# include <arpa/nameser_compat.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "ares.h"
#include "inet_net_pton.h"
#include "ares_private.h"
#ifdef WATT32
#undef WIN32
#endif
struct addr_query {
/* Arguments passed to ares_gethostbyaddr() */
ares_channel channel;
struct ares_addr addr;
ares_host_callback callback;
void *arg;
const char *remaining_lookups;
int timeouts;
};
static void next_lookup(struct addr_query *aquery);
static void addr_callback(void *arg, int status, int timeouts,
unsigned char *abuf, int alen);
static void end_aquery(struct addr_query *aquery, int status,
struct hostent *host);
static int file_lookup(struct ares_addr *addr, struct hostent **host);
static void ptr_rr_name(char *name, const struct ares_addr *addr);
void ares_gethostbyaddr(ares_channel channel, const void *addr, int addrlen,
int family, ares_host_callback callback, void *arg)
{
struct addr_query *aquery;
if (family != AF_INET && family != AF_INET6)
{
callback(arg, ARES_ENOTIMP, 0, NULL);
return;
}
if ((family == AF_INET && addrlen != sizeof(aquery->addr.addrV4)) ||
(family == AF_INET6 && addrlen != sizeof(aquery->addr.addrV6)))
{
callback(arg, ARES_ENOTIMP, 0, NULL);
return;
}
aquery = malloc(sizeof(struct addr_query));
if (!aquery)
{
callback(arg, ARES_ENOMEM, 0, NULL);
return;
}
aquery->channel = channel;
if (family == AF_INET)
memcpy(&aquery->addr.addrV4, addr, sizeof(aquery->addr.addrV4));
else
memcpy(&aquery->addr.addrV6, addr, sizeof(aquery->addr.addrV6));
aquery->addr.family = family;
aquery->callback = callback;
aquery->arg = arg;
aquery->remaining_lookups = channel->lookups;
aquery->timeouts = 0;
next_lookup(aquery);
}
static void next_lookup(struct addr_query *aquery)
{
const char *p;
char name[128];
int status;
struct hostent *host;
for (p = aquery->remaining_lookups; *p; p++)
{
switch (*p)
{
case 'b':
ptr_rr_name(name, &aquery->addr);
aquery->remaining_lookups = p + 1;
ares_query(aquery->channel, name, C_IN, T_PTR, addr_callback,
aquery);
return;
case 'f':
status = file_lookup(&aquery->addr, &host);
/* this status check below previously checked for !ARES_ENOTFOUND,
but we should not assume that this single error code is the one
that can occur, as that is in fact no longer the case */
if (status == ARES_SUCCESS)
{
end_aquery(aquery, status, host);
return;
}
break;
}
}
end_aquery(aquery, ARES_ENOTFOUND, NULL);
}
static void addr_callback(void *arg, int status, int timeouts,
unsigned char *abuf, int alen)
{
struct addr_query *aquery = (struct addr_query *) arg;
struct hostent *host;
size_t addrlen;
aquery->timeouts += timeouts;
if (status == ARES_SUCCESS)
{
if (aquery->addr.family == AF_INET)
{
addrlen = sizeof(aquery->addr.addrV4);
status = ares_parse_ptr_reply(abuf, alen, &aquery->addr.addrV4,
(int)addrlen, AF_INET, &host);
}
else
{
addrlen = sizeof(aquery->addr.addrV6);
status = ares_parse_ptr_reply(abuf, alen, &aquery->addr.addrV6,
(int)addrlen, AF_INET6, &host);
}
end_aquery(aquery, status, host);
}
else if (status == ARES_EDESTRUCTION)
end_aquery(aquery, status, NULL);
else
next_lookup(aquery);
}
static void end_aquery(struct addr_query *aquery, int status,
struct hostent *host)
{
aquery->callback(aquery->arg, status, aquery->timeouts, host);
if (host)
ares_free_hostent(host);
free(aquery);
}
static int file_lookup(struct ares_addr *addr, struct hostent **host)
{
FILE *fp;
int status;
int error;
#ifdef WIN32
char PATH_HOSTS[MAX_PATH];
if (IS_NT()) {
char tmp[MAX_PATH];
HKEY hkeyHosts;
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, WIN_NS_NT_KEY, 0, KEY_READ,
&hkeyHosts) == ERROR_SUCCESS)
{
DWORD dwLength = MAX_PATH;
RegQueryValueEx(hkeyHosts, DATABASEPATH, NULL, NULL, (LPBYTE)tmp,
&dwLength);
ExpandEnvironmentStrings(tmp, PATH_HOSTS, MAX_PATH);
RegCloseKey(hkeyHosts);
}
}
else
GetWindowsDirectory(PATH_HOSTS, MAX_PATH);
strcat(PATH_HOSTS, WIN_PATH_HOSTS);
#elif defined(WATT32)
extern const char *_w32_GetHostsFile (void);
const char *PATH_HOSTS = _w32_GetHostsFile();
if (!PATH_HOSTS)
return ARES_ENOTFOUND;
#endif
fp = fopen(PATH_HOSTS, "r");
if (!fp)
{
error = ERRNO;
switch(error)
{
case ENOENT:
case ESRCH:
return ARES_ENOTFOUND;
default:
DEBUGF(fprintf(stderr, "fopen() failed with error: %d %s\n",
error, strerror(error)));
DEBUGF(fprintf(stderr, "Error opening file: %s\n",
PATH_HOSTS));
*host = NULL;
return ARES_EFILE;
}
}
while ((status = ares__get_hostent(fp, addr->family, host)) == ARES_SUCCESS)
{
if (addr->family != (*host)->h_addrtype)
{
ares_free_hostent(*host);
continue;
}
if (addr->family == AF_INET)
{
if (memcmp((*host)->h_addr, &addr->addrV4,
sizeof(addr->addrV4)) == 0)
break;
}
else if (addr->family == AF_INET6)
{
if (memcmp((*host)->h_addr, &addr->addrV6,
sizeof(addr->addrV6)) == 0)
break;
}
ares_free_hostent(*host);
}
fclose(fp);
if (status == ARES_EOF)
status = ARES_ENOTFOUND;
if (status != ARES_SUCCESS)
*host = NULL;
return status;
}
static void ptr_rr_name(char *name, const struct ares_addr *addr)
{
if (addr->family == AF_INET)
{
unsigned long laddr = ntohl(addr->addrV4.s_addr);
unsigned long a1 = (laddr >> 24UL) & 0xFFUL;
unsigned long a2 = (laddr >> 16UL) & 0xFFUL;
unsigned long a3 = (laddr >> 8UL) & 0xFFUL;
unsigned long a4 = laddr & 0xFFUL;
sprintf(name, "%lu.%lu.%lu.%lu.in-addr.arpa", a4, a3, a2, a1);
}
else
{
unsigned char *bytes = (unsigned char *)&addr->addrV6;
/* There are too many arguments to do this in one line using
* minimally C89-compliant compilers */
sprintf(name,
"%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.",
bytes[15]&0xf, bytes[15] >> 4, bytes[14]&0xf, bytes[14] >> 4,
bytes[13]&0xf, bytes[13] >> 4, bytes[12]&0xf, bytes[12] >> 4,
bytes[11]&0xf, bytes[11] >> 4, bytes[10]&0xf, bytes[10] >> 4,
bytes[9]&0xf, bytes[9] >> 4, bytes[8]&0xf, bytes[8] >> 4);
sprintf(name+strlen(name),
"%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.ip6.arpa",
bytes[7]&0xf, bytes[7] >> 4, bytes[6]&0xf, bytes[6] >> 4,
bytes[5]&0xf, bytes[5] >> 4, bytes[4]&0xf, bytes[4] >> 4,
bytes[3]&0xf, bytes[3] >> 4, bytes[2]&0xf, bytes[2] >> 4,
bytes[1]&0xf, bytes[1] >> 4, bytes[0]&0xf, bytes[0] >> 4);
}
}

515
deps/c-ares/ares_gethostbyname.c vendored Normal file
View File

@@ -0,0 +1,515 @@
/* Copyright 1998 by the Massachusetts Institute of Technology.
*
* Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without
* fee is hereby granted, provided that the above copyright
* notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting
* documentation, and that the name of M.I.T. not be used in
* advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is"
* without express or implied warranty.
*/
#include "ares_setup.h"
#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
#ifdef HAVE_NETDB_H
# include <netdb.h>
#endif
#ifdef HAVE_ARPA_INET_H
# include <arpa/inet.h>
#endif
#ifdef HAVE_ARPA_NAMESER_H
# include <arpa/nameser.h>
#else
# include "nameser.h"
#endif
#ifdef HAVE_ARPA_NAMESER_COMPAT_H
# include <arpa/nameser_compat.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#ifdef HAVE_STRINGS_H
#include <strings.h>
#endif
#include "ares.h"
#include "inet_net_pton.h"
#include "bitncmp.h"
#include "ares_private.h"
#ifdef WATT32
#undef WIN32
#endif
struct host_query {
/* Arguments passed to ares_gethostbyname() */
ares_channel channel;
char *name;
ares_host_callback callback;
void *arg;
int sent_family; /* this family is what was is being used */
int want_family; /* this family is what is asked for in the API */
const char *remaining_lookups;
int timeouts;
};
static void next_lookup(struct host_query *hquery, int status_code);
static void host_callback(void *arg, int status, int timeouts,
unsigned char *abuf, int alen);
static void end_hquery(struct host_query *hquery, int status,
struct hostent *host);
static int fake_hostent(const char *name, int family,
ares_host_callback callback, void *arg);
static int file_lookup(const char *name, int family, struct hostent **host);
static void sort_addresses(struct hostent *host,
const struct apattern *sortlist, int nsort);
static void sort6_addresses(struct hostent *host,
const struct apattern *sortlist, int nsort);
static int get_address_index(const struct in_addr *addr,
const struct apattern *sortlist, int nsort);
static int get6_address_index(const struct ares_in6_addr *addr,
const struct apattern *sortlist, int nsort);
void ares_gethostbyname(ares_channel channel, const char *name, int family,
ares_host_callback callback, void *arg)
{
struct host_query *hquery;
/* Right now we only know how to look up Internet addresses - and unspec
means try both basically. */
switch (family) {
case AF_INET:
case AF_INET6:
case AF_UNSPEC:
break;
default:
callback(arg, ARES_ENOTIMP, 0, NULL);
return;
}
if (fake_hostent(name, family, callback, arg))
return;
/* Allocate and fill in the host query structure. */
hquery = malloc(sizeof(struct host_query));
if (!hquery)
{
callback(arg, ARES_ENOMEM, 0, NULL);
return;
}
hquery->channel = channel;
hquery->name = strdup(name);
hquery->want_family = family;
hquery->sent_family = -1; /* nothing is sent yet */
if (!hquery->name) {
free(hquery);
callback(arg, ARES_ENOMEM, 0, NULL);
return;
}
hquery->callback = callback;
hquery->arg = arg;
hquery->remaining_lookups = channel->lookups;
hquery->timeouts = 0;
/* Start performing lookups according to channel->lookups. */
next_lookup(hquery, ARES_ECONNREFUSED /* initial error code */);
}
static void next_lookup(struct host_query *hquery, int status_code)
{
const char *p;
struct hostent *host;
int status = status_code;
for (p = hquery->remaining_lookups; *p; p++)
{
switch (*p)
{
case 'b':
/* DNS lookup */
hquery->remaining_lookups = p + 1;
if ((hquery->want_family == AF_INET6) ||
(hquery->want_family == AF_UNSPEC)) {
/* if inet6 or unspec, start out with AAAA */
hquery->sent_family = AF_INET6;
ares_search(hquery->channel, hquery->name, C_IN, T_AAAA,
host_callback, hquery);
}
else {
hquery->sent_family = AF_INET;
ares_search(hquery->channel, hquery->name, C_IN, T_A,
host_callback, hquery);
}
return;
case 'f':
/* Host file lookup */
status = file_lookup(hquery->name, hquery->want_family, &host);
/* this status check below previously checked for !ARES_ENOTFOUND,
but we should not assume that this single error code is the one
that can occur, as that is in fact no longer the case */
if (status == ARES_SUCCESS)
{
end_hquery(hquery, status, host);
return;
}
status = status_code; /* Use original status code */
break;
}
}
end_hquery(hquery, status, NULL);
}
static void host_callback(void *arg, int status, int timeouts,
unsigned char *abuf, int alen)
{
struct host_query *hquery = (struct host_query *) arg;
ares_channel channel = hquery->channel;
struct hostent *host = NULL;
hquery->timeouts += timeouts;
if (status == ARES_SUCCESS)
{
if (hquery->sent_family == AF_INET)
{
status = ares_parse_a_reply(abuf, alen, &host, NULL, NULL);
if (host && channel->nsort)
sort_addresses(host, channel->sortlist, channel->nsort);
}
else if (hquery->sent_family == AF_INET6)
{
status = ares_parse_aaaa_reply(abuf, alen, &host, NULL, NULL);
if (status == ARES_ENODATA || status == ARES_EBADRESP) {
/* The query returned something but either there were no AAAA
records (e.g. just CNAME) or the response was malformed. Try
looking up A instead. We should possibly limit this
attempt-next logic to AF_UNSPEC lookups only. */
hquery->sent_family = AF_INET;
ares_search(hquery->channel, hquery->name, C_IN, T_A,
host_callback, hquery);
return;
}
if (host && channel->nsort)
sort6_addresses(host, channel->sortlist, channel->nsort);
}
end_hquery(hquery, status, host);
}
else if ((status == ARES_ENODATA || status == ARES_EBADRESP ||
status == ARES_ETIMEOUT) && hquery->sent_family == AF_INET6)
{
/* The AAAA query yielded no useful result. Now look up an A instead.
We should possibly limit this attempt-next logic to AF_UNSPEC lookups
only. */
hquery->sent_family = AF_INET;
ares_search(hquery->channel, hquery->name, C_IN, T_A, host_callback,
hquery);
}
else if (status == ARES_EDESTRUCTION)
end_hquery(hquery, status, NULL);
else
next_lookup(hquery, status);
}
static void end_hquery(struct host_query *hquery, int status,
struct hostent *host)
{
hquery->callback(hquery->arg, status, hquery->timeouts, host);
if (host)
ares_free_hostent(host);
free(hquery->name);
free(hquery);
}
/* If the name looks like an IP address, fake up a host entry, end the
* query immediately, and return true. Otherwise return false.
*/
static int fake_hostent(const char *name, int family,
ares_host_callback callback, void *arg)
{
struct hostent hostent;
char *aliases[1] = { NULL };
char *addrs[2];
int result = 0;
struct in_addr in;
struct ares_in6_addr in6;
if (family == AF_INET || family == AF_INET6)
{
/* It only looks like an IP address if it's all numbers and dots. */
int numdots = 0, valid = 1;
const char *p;
for (p = name; *p; p++)
{
if (!ISDIGIT(*p) && *p != '.') {
valid = 0;
break;
} else if (*p == '.') {
numdots++;
}
}
/* if we don't have 3 dots, it is illegal
* (although inet_addr doesn't think so).
*/
if (numdots != 3 || !valid)
result = 0;
else
result = ((in.s_addr = inet_addr(name)) == INADDR_NONE ? 0 : 1);
if (result)
family = AF_INET;
}
if (family == AF_INET6)
result = (ares_inet_pton(AF_INET6, name, &in6) < 1 ? 0 : 1);
if (!result)
return 0;
if (family == AF_INET)
{
hostent.h_length = (int)sizeof(struct in_addr);
addrs[0] = (char *)&in;
}
else if (family == AF_INET6)
{
hostent.h_length = (int)sizeof(struct ares_in6_addr);
addrs[0] = (char *)&in6;
}
/* Duplicate the name, to avoid a constness violation. */
hostent.h_name = strdup(name);
if (!hostent.h_name)
{
callback(arg, ARES_ENOMEM, 0, NULL);
return 1;
}
/* Fill in the rest of the host structure and terminate the query. */
addrs[1] = NULL;
hostent.h_aliases = aliases;
hostent.h_addrtype = family;
hostent.h_addr_list = addrs;
callback(arg, ARES_SUCCESS, 0, &hostent);
free((char *)(hostent.h_name));
return 1;
}
/* This is an API method */
int ares_gethostbyname_file(ares_channel channel, const char *name,
int family, struct hostent **host)
{
int result;
/* We only take the channel to ensure that ares_init() been called. */
if(channel == NULL)
{
/* Anything will do, really. This seems fine, and is consistent with
other error cases. */
*host = NULL;
return ARES_ENOTFOUND;
}
/* Just chain to the internal implementation we use here; it's exactly
* what we want.
*/
result = file_lookup(name, family, host);
if(result != ARES_SUCCESS)
{
/* We guarantee a NULL hostent on failure. */
*host = NULL;
}
return result;
}
static int file_lookup(const char *name, int family, struct hostent **host)
{
FILE *fp;
char **alias;
int status;
int error;
#ifdef WIN32
char PATH_HOSTS[MAX_PATH];
if (IS_NT()) {
char tmp[MAX_PATH];
HKEY hkeyHosts;
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, WIN_NS_NT_KEY, 0, KEY_READ,
&hkeyHosts) == ERROR_SUCCESS)
{
DWORD dwLength = MAX_PATH;
RegQueryValueEx(hkeyHosts, DATABASEPATH, NULL, NULL, (LPBYTE)tmp,
&dwLength);
ExpandEnvironmentStrings(tmp, PATH_HOSTS, MAX_PATH);
RegCloseKey(hkeyHosts);
}
}
else
GetWindowsDirectory(PATH_HOSTS, MAX_PATH);
strcat(PATH_HOSTS, WIN_PATH_HOSTS);
#elif defined(WATT32)
extern const char *_w32_GetHostsFile (void);
const char *PATH_HOSTS = _w32_GetHostsFile();
if (!PATH_HOSTS)
return ARES_ENOTFOUND;
#endif
fp = fopen(PATH_HOSTS, "r");
if (!fp)
{
error = ERRNO;
switch(error)
{
case ENOENT:
case ESRCH:
return ARES_ENOTFOUND;
default:
DEBUGF(fprintf(stderr, "fopen() failed with error: %d %s\n",
error, strerror(error)));
DEBUGF(fprintf(stderr, "Error opening file: %s\n",
PATH_HOSTS));
*host = NULL;
return ARES_EFILE;
}
}
while ((status = ares__get_hostent(fp, family, host)) == ARES_SUCCESS)
{
if (strcasecmp((*host)->h_name, name) == 0)
break;
for (alias = (*host)->h_aliases; *alias; alias++)
{
if (strcasecmp(*alias, name) == 0)
break;
}
if (*alias)
break;
ares_free_hostent(*host);
}
fclose(fp);
if (status == ARES_EOF)
status = ARES_ENOTFOUND;
if (status != ARES_SUCCESS)
*host = NULL;
return status;
}
static void sort_addresses(struct hostent *host,
const struct apattern *sortlist, int nsort)
{
struct in_addr a1, a2;
int i1, i2, ind1, ind2;
/* This is a simple insertion sort, not optimized at all. i1 walks
* through the address list, with the loop invariant that everything
* to the left of i1 is sorted. In the loop body, the value at i1 is moved
* back through the list (via i2) until it is in sorted order.
*/
for (i1 = 0; host->h_addr_list[i1]; i1++)
{
memcpy(&a1, host->h_addr_list[i1], sizeof(struct in_addr));
ind1 = get_address_index(&a1, sortlist, nsort);
for (i2 = i1 - 1; i2 >= 0; i2--)
{
memcpy(&a2, host->h_addr_list[i2], sizeof(struct in_addr));
ind2 = get_address_index(&a2, sortlist, nsort);
if (ind2 <= ind1)
break;
memcpy(host->h_addr_list[i2 + 1], &a2, sizeof(struct in_addr));
}
memcpy(host->h_addr_list[i2 + 1], &a1, sizeof(struct in_addr));
}
}
/* Find the first entry in sortlist which matches addr. Return nsort
* if none of them match.
*/
static int get_address_index(const struct in_addr *addr,
const struct apattern *sortlist,
int nsort)
{
int i;
for (i = 0; i < nsort; i++)
{
if (sortlist[i].family != AF_INET)
continue;
if (sortlist[i].type == PATTERN_MASK)
{
if ((addr->s_addr & sortlist[i].mask.addr4.s_addr)
== sortlist[i].addrV4.s_addr)
break;
}
else
{
if (!ares_bitncmp(&addr->s_addr, &sortlist[i].addrV4.s_addr,
sortlist[i].mask.bits))
break;
}
}
return i;
}
static void sort6_addresses(struct hostent *host,
const struct apattern *sortlist, int nsort)
{
struct ares_in6_addr a1, a2;
int i1, i2, ind1, ind2;
/* This is a simple insertion sort, not optimized at all. i1 walks
* through the address list, with the loop invariant that everything
* to the left of i1 is sorted. In the loop body, the value at i1 is moved
* back through the list (via i2) until it is in sorted order.
*/
for (i1 = 0; host->h_addr_list[i1]; i1++)
{
memcpy(&a1, host->h_addr_list[i1], sizeof(struct ares_in6_addr));
ind1 = get6_address_index(&a1, sortlist, nsort);
for (i2 = i1 - 1; i2 >= 0; i2--)
{
memcpy(&a2, host->h_addr_list[i2], sizeof(struct ares_in6_addr));
ind2 = get6_address_index(&a2, sortlist, nsort);
if (ind2 <= ind1)
break;
memcpy(host->h_addr_list[i2 + 1], &a2, sizeof(struct ares_in6_addr));
}
memcpy(host->h_addr_list[i2 + 1], &a1, sizeof(struct ares_in6_addr));
}
}
/* Find the first entry in sortlist which matches addr. Return nsort
* if none of them match.
*/
static int get6_address_index(const struct ares_in6_addr *addr,
const struct apattern *sortlist,
int nsort)
{
int i;
for (i = 0; i < nsort; i++)
{
if (sortlist[i].family != AF_INET6)
continue;
if (!ares_bitncmp(addr,
&sortlist[i].addrV6,
sortlist[i].mask.bits))
break;
}
return i;
}

426
deps/c-ares/ares_getnameinfo.c vendored Normal file
View File

@@ -0,0 +1,426 @@
/* Copyright 2005 by Dominick Meglio
*
* Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without
* fee is hereby granted, provided that the above copyright
* notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting
* documentation, and that the name of M.I.T. not be used in
* advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is"
* without express or implied warranty.
*/
#include "ares_setup.h"
#ifdef HAVE_GETSERVBYPORT_R
# if !defined(GETSERVBYPORT_R_ARGS) || \
(GETSERVBYPORT_R_ARGS < 4) || (GETSERVBYPORT_R_ARGS > 6)
# error "you MUST specifiy a valid number of arguments for getservbyport_r"
# endif
#endif
#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
#ifdef HAVE_NETDB_H
# include <netdb.h>
#endif
#ifdef HAVE_ARPA_INET_H
# include <arpa/inet.h>
#endif
#ifdef HAVE_ARPA_NAMESER_H
# include <arpa/nameser.h>
#else
# include "nameser.h"
#endif
#ifdef HAVE_ARPA_NAMESER_COMPAT_H
# include <arpa/nameser_compat.h>
#endif
#ifdef HAVE_NET_IF_H
#include <net/if.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "ares.h"
#include "ares_ipv6.h"
#include "inet_ntop.h"
#include "ares_private.h"
struct nameinfo_query {
ares_nameinfo_callback callback;
void *arg;
union {
struct sockaddr_in addr4;
struct sockaddr_in6 addr6;
} addr;
int family;
int flags;
int timeouts;
};
#ifdef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID
#define IPBUFSIZ \
(sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255") + IF_NAMESIZE)
#else
#define IPBUFSIZ \
(sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"))
#endif
static void nameinfo_callback(void *arg, int status, int timeouts,
struct hostent *host);
static char *lookup_service(unsigned short port, int flags,
char *buf, size_t buflen);
#ifdef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID
static void append_scopeid(struct sockaddr_in6 *addr6, unsigned int scopeid,
char *buf, size_t buflen);
#endif
static char *ares_striendstr(const char *s1, const char *s2);
void ares_getnameinfo(ares_channel channel, const struct sockaddr *sa,
ares_socklen_t salen,
int flags, ares_nameinfo_callback callback, void *arg)
{
struct sockaddr_in *addr = NULL;
struct sockaddr_in6 *addr6 = NULL;
struct nameinfo_query *niquery;
unsigned int port = 0;
/* Validate socket address family and length */
if ((sa->sa_family == AF_INET) &&
(salen == sizeof(struct sockaddr_in)))
{
addr = (struct sockaddr_in *)sa;
port = addr->sin_port;
}
else if ((sa->sa_family == AF_INET6) &&
(salen == sizeof(struct sockaddr_in6)))
{
addr6 = (struct sockaddr_in6 *)sa;
port = addr6->sin6_port;
}
else
{
callback(arg, ARES_ENOTIMP, 0, NULL, NULL);
return;
}
/* If neither, assume they want a host */
if (!(flags & ARES_NI_LOOKUPSERVICE) && !(flags & ARES_NI_LOOKUPHOST))
flags |= ARES_NI_LOOKUPHOST;
/* All they want is a service, no need for DNS */
if ((flags & ARES_NI_LOOKUPSERVICE) && !(flags & ARES_NI_LOOKUPHOST))
{
char buf[33], *service;
service = lookup_service((unsigned short)(port & 0xffff),
flags, buf, sizeof(buf));
callback(arg, ARES_SUCCESS, 0, NULL, service);
return;
}
/* They want a host lookup */
if ((flags & ARES_NI_LOOKUPHOST))
{
/* A numeric host can be handled without DNS */
if ((flags & ARES_NI_NUMERICHOST))
{
char ipbuf[IPBUFSIZ];
char srvbuf[33];
char *service = NULL;
ipbuf[0] = 0;
/* Specifying not to lookup a host, but then saying a host
* is required has to be illegal.
*/
if (flags & ARES_NI_NAMEREQD)
{
callback(arg, ARES_EBADFLAGS, 0, NULL, NULL);
return;
}
if (salen == sizeof(struct sockaddr_in6))
{
ares_inet_ntop(AF_INET6, &addr6->sin6_addr, ipbuf, IPBUFSIZ);
/* If the system supports scope IDs, use it */
#ifdef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID
append_scopeid(addr6, flags, ipbuf, sizeof(ipbuf));
#endif
}
else
{
ares_inet_ntop(AF_INET, &addr->sin_addr, ipbuf, IPBUFSIZ);
}
/* They also want a service */
if (flags & ARES_NI_LOOKUPSERVICE)
service = lookup_service((unsigned short)(port & 0xffff),
flags, srvbuf, sizeof(srvbuf));
callback(arg, ARES_SUCCESS, 0, ipbuf, service);
return;
}
/* This is where a DNS lookup becomes necessary */
else
{
niquery = malloc(sizeof(struct nameinfo_query));
if (!niquery)
{
callback(arg, ARES_ENOMEM, 0, NULL, NULL);
return;
}
niquery->callback = callback;
niquery->arg = arg;
niquery->flags = flags;
niquery->timeouts = 0;
if (sa->sa_family == AF_INET)
{
niquery->family = AF_INET;
memcpy(&niquery->addr.addr4, addr, sizeof(addr));
ares_gethostbyaddr(channel, &addr->sin_addr,
sizeof(struct in_addr), AF_INET,
nameinfo_callback, niquery);
}
else
{
niquery->family = AF_INET6;
memcpy(&niquery->addr.addr6, addr6, sizeof(addr6));
ares_gethostbyaddr(channel, &addr6->sin6_addr,
sizeof(struct ares_in6_addr), AF_INET6,
nameinfo_callback, niquery);
}
}
}
}
static void nameinfo_callback(void *arg, int status, int timeouts,
struct hostent *host)
{
struct nameinfo_query *niquery = (struct nameinfo_query *) arg;
char srvbuf[33];
char *service = NULL;
niquery->timeouts += timeouts;
if (status == ARES_SUCCESS)
{
/* They want a service too */
if (niquery->flags & ARES_NI_LOOKUPSERVICE)
{
if (niquery->family == AF_INET)
service = lookup_service(niquery->addr.addr4.sin_port,
niquery->flags, srvbuf, sizeof(srvbuf));
else
service = lookup_service(niquery->addr.addr6.sin6_port,
niquery->flags, srvbuf, sizeof(srvbuf));
}
/* NOFQDN means we have to strip off the domain name portion. We do
this by determining our own domain name, then searching the string
for this domain name and removing it.
*/
#ifdef HAVE_GETHOSTNAME
if (niquery->flags & ARES_NI_NOFQDN)
{
char buf[255];
char *domain;
gethostname(buf, 255);
if ((domain = strchr(buf, '.')) != NULL)
{
char *end = ares_striendstr(host->h_name, domain);
if (end)
*end = 0;
}
}
#endif
niquery->callback(niquery->arg, ARES_SUCCESS, niquery->timeouts,
(char *)(host->h_name),
service);
free(niquery);
return;
}
/* We couldn't find the host, but it's OK, we can use the IP */
else if (status == ARES_ENOTFOUND && !(niquery->flags & ARES_NI_NAMEREQD))
{
char ipbuf[IPBUFSIZ];
if (niquery->family == AF_INET)
ares_inet_ntop(AF_INET, &niquery->addr.addr4.sin_addr, ipbuf,
IPBUFSIZ);
else
{
ares_inet_ntop(AF_INET6, &niquery->addr.addr6.sin6_addr, ipbuf,
IPBUFSIZ);
#ifdef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID
append_scopeid(&niquery->addr.addr6, niquery->flags, ipbuf,
sizeof(ipbuf));
#endif
}
/* They want a service too */
if (niquery->flags & ARES_NI_LOOKUPSERVICE)
{
if (niquery->family == AF_INET)
service = lookup_service(niquery->addr.addr4.sin_port,
niquery->flags, srvbuf, sizeof(srvbuf));
else
service = lookup_service(niquery->addr.addr6.sin6_port,
niquery->flags, srvbuf, sizeof(srvbuf));
}
niquery->callback(niquery->arg, ARES_SUCCESS, niquery->timeouts, ipbuf,
service);
free(niquery);
return;
}
niquery->callback(niquery->arg, status, niquery->timeouts, NULL, NULL);
free(niquery);
}
static char *lookup_service(unsigned short port, int flags,
char *buf, size_t buflen)
{
const char *proto;
struct servent *sep;
#ifdef HAVE_GETSERVBYPORT_R
struct servent se;
#endif
char tmpbuf[4096];
if (port)
{
if (flags & ARES_NI_NUMERICSERV)
sep = NULL;
else
{
if (flags & ARES_NI_UDP)
proto = "udp";
else if (flags & ARES_NI_SCTP)
proto = "sctp";
else if (flags & ARES_NI_DCCP)
proto = "dccp";
else
proto = "tcp";
#ifdef HAVE_GETSERVBYPORT_R
sep = &se;
memset(tmpbuf, 0, sizeof(tmpbuf));
#if GETSERVBYPORT_R_ARGS == 6
if (getservbyport_r(port, proto, &se, (void *)tmpbuf,
sizeof(tmpbuf), &sep) != 0)
sep = NULL;
#elif GETSERVBYPORT_R_ARGS == 5
sep = getservbyport_r(port, proto, &se, (void *)tmpbuf,
sizeof(tmpbuf));
#elif GETSERVBYPORT_R_ARGS == 4
if (getservbyport_r(port, proto, &se, (void *)tmpbuf) != 0)
sep = NULL;
#else
/* Lets just hope the OS uses TLS! */
sep = getservbyport(port, proto);
#endif
#else
/* Lets just hope the OS uses TLS! */
#if (defined(NETWARE) && !defined(__NOVELL_LIBC__))
sep = getservbyport(port, (char*)proto);
#else
sep = getservbyport(port, proto);
#endif
#endif
}
if (sep && sep->s_name)
/* get service name */
strcpy(tmpbuf, sep->s_name);
else
/* get port as a string */
sprintf(tmpbuf, "%u", (unsigned int)ntohs(port));
if (strlen(tmpbuf) < buflen)
/* return it if buffer big enough */
strcpy(buf, tmpbuf);
else
/* avoid reusing previous one */
buf[0] = '\0';
return buf;
}
buf[0] = '\0';
return NULL;
}
#ifdef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID
static void append_scopeid(struct sockaddr_in6 *addr6, unsigned int flags,
char *buf, size_t buflen)
{
#ifdef HAVE_IF_INDEXTONAME
int is_ll, is_mcll;
#endif
static const char fmt_u[] = "%u";
static const char fmt_lu[] = "%lu";
char tmpbuf[IF_NAMESIZE + 2];
size_t bufl;
const char *fmt = (sizeof(addr6->sin6_scope_id) > sizeof(unsigned int))?
fmt_lu:fmt_u;
tmpbuf[0] = '%';
#ifdef HAVE_IF_INDEXTONAME
is_ll = IN6_IS_ADDR_LINKLOCAL(&addr6->sin6_addr);
is_mcll = IN6_IS_ADDR_MC_LINKLOCAL(&addr6->sin6_addr);
if ((flags & ARES_NI_NUMERICSCOPE) ||
(!is_ll && !is_mcll))
{
sprintf(&tmpbuf[1], fmt, addr6->sin6_scope_id);
}
else
{
if (if_indextoname(addr6->sin6_scope_id, &tmpbuf[1]) == NULL)
sprintf(&tmpbuf[1], fmt, addr6->sin6_scope_id);
}
#else
sprintf(&tmpbuf[1], fmt, addr6->sin6_scope_id);
(void) flags;
#endif
tmpbuf[IF_NAMESIZE + 1] = '\0';
bufl = strlen(buf);
if(bufl + strlen(tmpbuf) < buflen)
/* only append the scopeid string if it fits in the target buffer */
strcpy(&buf[bufl], tmpbuf);
}
#endif
/* Determines if s1 ends with the string in s2 (case-insensitive) */
static char *ares_striendstr(const char *s1, const char *s2)
{
const char *c1, *c2, *c1_begin;
int lo1, lo2;
size_t s1_len = strlen(s1), s2_len = strlen(s2);
/* If the substr is longer than the full str, it can't match */
if (s2_len > s1_len)
return NULL;
/* Jump to the end of s1 minus the length of s2 */
c1_begin = s1+s1_len-s2_len;
c1 = (const char *)c1_begin;
c2 = s2;
while (c2 < s2+s2_len)
{
lo1 = TOLOWER(*c1);
lo2 = TOLOWER(*c2);
if (lo1 != lo2)
return NULL;
else
{
c1++;
c2++;
}
}
if (c2 == c1 && c2 == NULL)
return (char *)c1_begin;
return NULL;
}

122
deps/c-ares/ares_getopt.c vendored Normal file
View File

@@ -0,0 +1,122 @@
/*
* Original file name getopt.c Initial import into the c-ares source tree
* on 2007-04-11. Lifted from version 5.2 of the 'Open Mash' project with
* the modified BSD license, BSD license without the advertising clause.
*
*/
/*
* getopt.c --
*
* Standard UNIX getopt function. Code is from BSD.
*
* Copyright (c) 1987-2001 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* A. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* B. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* C. Neither the names of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
* IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/* #if !defined(lint)
* static char sccsid[] = "@(#)getopt.c 8.2 (Berkeley) 4/2/94";
* #endif
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "ares_getopt.h"
int opterr = 1, /* if error message should be printed */
optind = 1; /* index into parent argv vector */
int optopt = 0; /* character checked for validity */
static int optreset; /* reset getopt */
char *optarg; /* argument associated with option */
#define BADCH (int)'?'
#define BADARG (int)':'
#define EMSG (char *)""
/*
* ares_getopt --
* Parse argc/argv argument vector.
*/
int
ares_getopt(int nargc, char * const nargv[], const char *ostr)
{
static char *place = EMSG; /* option letter processing */
char *oli; /* option letter list index */
if (optreset || !*place) { /* update scanning pointer */
optreset = 0;
if (optind >= nargc || *(place = nargv[optind]) != '-') {
place = EMSG;
return (EOF);
}
if (place[1] && *++place == '-') { /* found "--" */
++optind;
place = EMSG;
return (EOF);
}
} /* option letter okay? */
if ((optopt = (int)*place++) == (int)':' ||
(oli = strchr(ostr, optopt)) == NULL) {
/*
* if the user didn't specify '-' as an option,
* assume it means EOF.
*/
if (optopt == (int)'-')
return (EOF);
if (!*place)
++optind;
if (opterr && *ostr != ':')
(void)fprintf(stderr,
"%s: illegal option -- %c\n", __FILE__, optopt);
return (BADCH);
}
if (*++oli != ':') { /* don't need argument */
optarg = NULL;
if (!*place)
++optind;
}
else { /* need an argument */
if (*place) /* no white space */
optarg = place;
else if (nargc <= ++optind) { /* no arg */
place = EMSG;
if (*ostr == ':')
return (BADARG);
if (opterr)
(void)fprintf(stderr,
"%s: option requires an argument -- %c\n",
__FILE__, optopt);
return (BADCH);
}
else /* white space */
optarg = nargv[optind];
place = EMSG;
++optind;
}
return (optopt); /* dump back option letter */
}

53
deps/c-ares/ares_getopt.h vendored Normal file
View File

@@ -0,0 +1,53 @@
#ifndef ARES_GETOPT_H
#define ARES_GETOPT_H
/*
* Copyright (c) 1987-2001 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* A. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* B. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* C. Neither the names of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
* IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
int ares_getopt(int nargc, char * const nargv[], const char *ostr);
#undef optarg
#undef optind
#undef opterr
#undef optopt
#undef optreset
#define optarg ares_optarg
#define optind ares_optind
#define opterr ares_opterr
#define optopt ares_optopt
#define optreset ares_optreset
extern char *optarg;
extern int optind;
extern int opterr;
extern int optopt;
#endif /* ARES_GETOPT_H */

72
deps/c-ares/ares_getsock.c vendored Normal file
View File

@@ -0,0 +1,72 @@
/* Copyright (C) 2005 - 2010, Daniel Stenberg
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted, provided
* that the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of M.I.T. not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. M.I.T. makes no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*/
#include "ares_setup.h"
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#include "ares.h"
#include "ares_private.h"
int ares_getsock(ares_channel channel,
ares_socket_t *socks,
int numsocks) /* size of the 'socks' array */
{
struct server_state *server;
int i;
int sockindex=0;
int bitmap = 0;
unsigned int setbits = 0xffffffff;
/* Are there any active queries? */
int active_queries = !ares__is_list_empty(&(channel->all_queries));
for (i = 0;
(i < channel->nservers) && (sockindex < ARES_GETSOCK_MAXNUM);
i++)
{
server = &channel->servers[i];
/* We only need to register interest in UDP sockets if we have
* outstanding queries.
*/
if (active_queries && server->udp_socket != ARES_SOCKET_BAD)
{
if(sockindex >= numsocks)
break;
socks[sockindex] = server->udp_socket;
bitmap |= ARES_GETSOCK_READABLE(setbits, sockindex);
sockindex++;
}
/* We always register for TCP events, because we want to know
* when the other side closes the connection, so we don't waste
* time trying to use a broken connection.
*/
if (server->tcp_socket != ARES_SOCKET_BAD)
{
if(sockindex >= numsocks)
break;
socks[sockindex] = server->tcp_socket;
bitmap |= ARES_GETSOCK_READABLE(setbits, sockindex);
if (server->qhead && active_queries)
/* then the tcp socket is also writable! */
bitmap |= ARES_GETSOCK_WRITABLE(setbits, sockindex);
sockindex++;
}
}
return bitmap;
}

1665
deps/c-ares/ares_init.c vendored Normal file

File diff suppressed because it is too large Load Diff

78
deps/c-ares/ares_ipv6.h vendored Normal file
View File

@@ -0,0 +1,78 @@
/* Copyright (C) 2005 by Dominick Meglio
*
* Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without
* fee is hereby granted, provided that the above copyright
* notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting
* documentation, and that the name of M.I.T. not be used in
* advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is"
* without express or implied warranty.
*/
#ifndef ARES_IPV6_H
#define ARES_IPV6_H
#ifndef HAVE_PF_INET6
#define PF_INET6 AF_INET6
#endif
#ifndef HAVE_STRUCT_SOCKADDR_IN6
struct sockaddr_in6
{
unsigned short sin6_family;
unsigned short sin6_port;
unsigned long sin6_flowinfo;
struct ares_in6_addr sin6_addr;
unsigned int sin6_scope_id;
};
#endif
#ifndef HAVE_STRUCT_ADDRINFO
struct addrinfo
{
int ai_flags;
int ai_family;
int ai_socktype;
int ai_protocol;
ares_socklen_t ai_addrlen; /* Follow rfc3493 struct addrinfo */
char *ai_canonname;
struct sockaddr *ai_addr;
struct addrinfo *ai_next;
};
#endif
#ifndef NS_IN6ADDRSZ
#if SIZEOF_STRUCT_IN6_ADDR == 0
/* We cannot have it set to zero, so we pick a fixed value here */
#define NS_IN6ADDRSZ 16
#else
#define NS_IN6ADDRSZ SIZEOF_STRUCT_IN6_ADDR
#endif
#endif
#ifndef NS_INADDRSZ
#define NS_INADDRSZ SIZEOF_STRUCT_IN_ADDR
#endif
#ifndef NS_INT16SZ
#define NS_INT16SZ 2
#endif
#ifndef IF_NAMESIZE
#ifdef IFNAMSIZ
#define IF_NAMESIZE IFNAMSIZ
#else
#define IF_NAMESIZE 256
#endif
#endif
/* Defined in ares_net_pton.c for no particular reason. */
extern const struct ares_in6_addr ares_in6addr_any; /* :: */
#endif /* ARES_IPV6_H */

132
deps/c-ares/ares_library_init.c vendored Normal file
View File

@@ -0,0 +1,132 @@
/* Copyright 1998 by the Massachusetts Institute of Technology.
* Copyright (C) 2004-2009 by Daniel Stenberg
*
* Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without
* fee is hereby granted, provided that the above copyright
* notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting
* documentation, and that the name of M.I.T. not be used in
* advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is"
* without express or implied warranty.
*/
#include "ares_setup.h"
#include "ares.h"
#include "ares_library_init.h"
#include "ares_private.h"
/* library-private global and unique instance vars */
#ifdef USE_WINSOCK
fpGetNetworkParams_t ares_fpGetNetworkParams = ZERO_NULL;
fpSystemFunction036_t ares_fpSystemFunction036 = ZERO_NULL;
#endif
/* library-private global vars with source visibility restricted to this file */
static unsigned int ares_initialized;
static int ares_init_flags;
#ifdef USE_WINSOCK
static HMODULE hnd_iphlpapi;
static HMODULE hnd_advapi32;
#endif
static int ares_win32_init(void)
{
#ifdef USE_WINSOCK
hnd_iphlpapi = 0;
hnd_iphlpapi = LoadLibrary("iphlpapi.dll");
if (!hnd_iphlpapi)
return ARES_ELOADIPHLPAPI;
ares_fpGetNetworkParams = (fpGetNetworkParams_t)
GetProcAddress(hnd_iphlpapi, "GetNetworkParams");
if (!ares_fpGetNetworkParams)
{
FreeLibrary(hnd_iphlpapi);
return ARES_EADDRGETNETWORKPARAMS;
}
/*
* When advapi32.dll is unavailable or advapi32.dll has no SystemFunction036,
* also known as RtlGenRandom, which is the case for Windows versions prior
* to WinXP then c-ares uses portable rand() function. Then don't error here.
*/
hnd_advapi32 = 0;
hnd_advapi32 = LoadLibrary("advapi32.dll");
if (hnd_advapi32)
{
ares_fpSystemFunction036 = (fpSystemFunction036_t)
GetProcAddress(hnd_advapi32, "SystemFunction036");
}
#endif
return ARES_SUCCESS;
}
static void ares_win32_cleanup(void)
{
#ifdef USE_WINSOCK
if (hnd_advapi32)
FreeLibrary(hnd_advapi32);
if (hnd_iphlpapi)
FreeLibrary(hnd_iphlpapi);
#endif
}
int ares_library_init(int flags)
{
int res;
if (ares_initialized)
return ARES_SUCCESS;
ares_initialized++;
if (flags & ARES_LIB_INIT_WIN32)
{
res = ares_win32_init();
if (res != ARES_SUCCESS)
return res;
}
ares_init_flags = flags;
return ARES_SUCCESS;
}
void ares_library_cleanup(void)
{
if (!ares_initialized)
return;
ares_initialized--;
if (ares_init_flags & ARES_LIB_INIT_WIN32)
ares_win32_cleanup();
ares_init_flags = ARES_LIB_INIT_NONE;
}
int ares_library_initialized(void)
{
#ifdef USE_WINSOCK
if (!ares_initialized)
return ARES_ENOTINITIALIZED;
#endif
return ARES_SUCCESS;
}

39
deps/c-ares/ares_library_init.h vendored Normal file
View File

@@ -0,0 +1,39 @@
#ifndef HEADER_CARES_LIBRARY_INIT_H
#define HEADER_CARES_LIBRARY_INIT_H
/* Copyright 1998 by the Massachusetts Institute of Technology.
* Copyright (C) 2004-2009 by Daniel Stenberg
*
* Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without
* fee is hereby granted, provided that the above copyright
* notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting
* documentation, and that the name of M.I.T. not be used in
* advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is"
* without express or implied warranty.
*/
#include "ares_setup.h"
#ifdef USE_WINSOCK
#include <iphlpapi.h>
typedef DWORD (WINAPI *fpGetNetworkParams_t) (FIXED_INFO*, DWORD*);
typedef BOOLEAN (APIENTRY *fpSystemFunction036_t) (void*, ULONG);
/* Forward-declaration of variables defined in ares_library_init.c */
/* that are global and unique instances for whole c-ares library. */
extern fpGetNetworkParams_t ares_fpGetNetworkParams;
extern fpSystemFunction036_t ares_fpSystemFunction036;
#endif /* USE_WINSOCK */
#endif /* HEADER_CARES_LIBRARY_INIT_H */

86
deps/c-ares/ares_llist.c vendored Normal file
View File

@@ -0,0 +1,86 @@
/* Copyright 1998 by the Massachusetts Institute of Technology.
*
* Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without
* fee is hereby granted, provided that the above copyright
* notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting
* documentation, and that the name of M.I.T. not be used in
* advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is"
* without express or implied warranty.
*/
#include "ares_setup.h"
#include "ares.h"
#include "ares_private.h"
/* Routines for managing doubly-linked circular linked lists with a
* dummy head.
*/
/* Initialize a new head node */
void ares__init_list_head(struct list_node* head) {
head->prev = head;
head->next = head;
head->data = NULL;
}
/* Initialize a list node */
void ares__init_list_node(struct list_node* node, void* d) {
node->prev = NULL;
node->next = NULL;
node->data = d;
}
/* Returns true iff the given list is empty */
int ares__is_list_empty(struct list_node* head) {
return ((head->next == head) && (head->prev == head));
}
/* Inserts new_node before old_node */
void ares__insert_in_list(struct list_node* new_node,
struct list_node* old_node) {
new_node->next = old_node;
new_node->prev = old_node->prev;
old_node->prev->next = new_node;
old_node->prev = new_node;
}
/* Removes the node from the list it's in, if any */
void ares__remove_from_list(struct list_node* node) {
if (node->next != NULL) {
node->prev->next = node->next;
node->next->prev = node->prev;
node->prev = NULL;
node->next = NULL;
}
}
/* Swap the contents of two lists */
void ares__swap_lists(struct list_node* head_a,
struct list_node* head_b) {
int is_a_empty = ares__is_list_empty(head_a);
int is_b_empty = ares__is_list_empty(head_b);
struct list_node old_a = *head_a;
struct list_node old_b = *head_b;
if (is_a_empty) {
ares__init_list_head(head_b);
} else {
*head_b = old_a;
old_a.next->prev = head_b;
old_a.prev->next = head_b;
}
if (is_b_empty) {
ares__init_list_head(head_a);
} else {
*head_a = old_b;
old_b.next->prev = head_a;
old_b.prev->next = head_a;
}
}

42
deps/c-ares/ares_llist.h vendored Normal file
View File

@@ -0,0 +1,42 @@
#ifndef __ARES_LLIST_H
#define __ARES_LLIST_H
/* Copyright 1998 by the Massachusetts Institute of Technology.
*
* Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without
* fee is hereby granted, provided that the above copyright
* notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting
* documentation, and that the name of M.I.T. not be used in
* advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is"
* without express or implied warranty.
*/
/* Node definition for circular, doubly-linked list */
struct list_node {
struct list_node *prev;
struct list_node *next;
void* data;
};
void ares__init_list_head(struct list_node* head);
void ares__init_list_node(struct list_node* node, void* d);
int ares__is_list_empty(struct list_node* head);
void ares__insert_in_list(struct list_node* new_node,
struct list_node* old_node);
void ares__remove_from_list(struct list_node* node);
void ares__swap_lists(struct list_node* head_a,
struct list_node* head_b);
#endif /* __ARES_LLIST_H */

195
deps/c-ares/ares_mkquery.c vendored Normal file
View File

@@ -0,0 +1,195 @@
/* Copyright 1998 by the Massachusetts Institute of Technology.
*
* Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without
* fee is hereby granted, provided that the above copyright
* notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting
* documentation, and that the name of M.I.T. not be used in
* advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is"
* without express or implied warranty.
*/
#include "ares_setup.h"
#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
#ifdef HAVE_ARPA_NAMESER_H
# include <arpa/nameser.h>
#else
# include "nameser.h"
#endif
#ifdef HAVE_ARPA_NAMESER_COMPAT_H
# include <arpa/nameser_compat.h>
#endif
#include <stdlib.h>
#include <string.h>
#include "ares.h"
#include "ares_dns.h"
#include "ares_private.h"
/* Header format, from RFC 1035:
* 1 1 1 1 1 1
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* | ID |
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* |QR| Opcode |AA|TC|RD|RA| Z | RCODE |
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* | QDCOUNT |
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* | ANCOUNT |
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* | NSCOUNT |
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* | ARCOUNT |
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
*
* AA, TC, RA, and RCODE are only set in responses. Brief description
* of the remaining fields:
* ID Identifier to match responses with queries
* QR Query (0) or response (1)
* Opcode For our purposes, always QUERY
* RD Recursion desired
* Z Reserved (zero)
* QDCOUNT Number of queries
* ANCOUNT Number of answers
* NSCOUNT Number of name server records
* ARCOUNT Number of additional records
*
* Question format, from RFC 1035:
* 1 1 1 1 1 1
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* | |
* / QNAME /
* / /
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* | QTYPE |
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
* | QCLASS |
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
*
* The query name is encoded as a series of labels, each represented
* as a one-byte length (maximum 63) followed by the text of the
* label. The list is terminated by a label of length zero (which can
* be thought of as the root domain).
*/
int ares_mkquery(const char *name, int dnsclass, int type, unsigned short id,
int rd, unsigned char **buf, int *buflen)
{
int len;
unsigned char *q;
const char *p;
/* Set our results early, in case we bail out early with an error. */
*buflen = 0;
*buf = NULL;
/* Compute the length of the encoded name so we can check buflen.
* Start counting at 1 for the zero-length label at the end. */
len = 1;
for (p = name; *p; p++)
{
if (*p == '\\' && *(p + 1) != 0)
p++;
len++;
}
/* If there are n periods in the name, there are n + 1 labels, and
* thus n + 1 length fields, unless the name is empty or ends with a
* period. So add 1 unless name is empty or ends with a period.
*/
if (*name && *(p - 1) != '.')
len++;
/* Immediately reject names that are longer than the maximum of 255
* bytes that's specified in RFC 1035 ("To simplify implementations,
* the total length of a domain name (i.e., label octets and label
* length octets) is restricted to 255 octets or less."). We aren't
* doing this just to be a stickler about RFCs. For names that are
* too long, 'dnscache' closes its TCP connection to us immediately
* (when using TCP) and ignores the request when using UDP, and
* BIND's named returns ServFail (TCP or UDP). Sending a request
* that we know will cause 'dnscache' to close the TCP connection is
* painful, since that makes any other outstanding requests on that
* connection fail. And sending a UDP request that we know
* 'dnscache' will ignore is bad because resources will be tied up
* until we time-out the request.
*/
if (len > MAXCDNAME)
return ARES_EBADNAME;
*buflen = len + HFIXEDSZ + QFIXEDSZ;
*buf = malloc(*buflen);
if (!*buf)
return ARES_ENOMEM;
/* Set up the header. */
q = *buf;
memset(q, 0, HFIXEDSZ);
DNS_HEADER_SET_QID(q, id);
DNS_HEADER_SET_OPCODE(q, QUERY);
if (rd) {
DNS_HEADER_SET_RD(q, 1);
}
else {
DNS_HEADER_SET_RD(q, 0);
}
DNS_HEADER_SET_QDCOUNT(q, 1);
/* A name of "." is a screw case for the loop below, so adjust it. */
if (strcmp(name, ".") == 0)
name++;
/* Start writing out the name after the header. */
q += HFIXEDSZ;
while (*name)
{
if (*name == '.')
return ARES_EBADNAME;
/* Count the number of bytes in this label. */
len = 0;
for (p = name; *p && *p != '.'; p++)
{
if (*p == '\\' && *(p + 1) != 0)
p++;
len++;
}
if (len > MAXLABEL)
return ARES_EBADNAME;
/* Encode the length and copy the data. */
*q++ = (unsigned char)len;
for (p = name; *p && *p != '.'; p++)
{
if (*p == '\\' && *(p + 1) != 0)
p++;
*q++ = *p;
}
/* Go to the next label and repeat, unless we hit the end. */
if (!*p)
break;
name = p + 1;
}
/* Add the zero-length label at the end. */
*q++ = 0;
/* Finish off the question with the type and class. */
DNS_QUESTION_SET_TYPE(q, type);
DNS_QUESTION_SET_CLASS(q, dnsclass);
return ARES_SUCCESS;
}

70
deps/c-ares/ares_nowarn.c vendored Normal file
View File

@@ -0,0 +1,70 @@
/* Copyright (C) 2010 by Daniel Stenberg
*
* Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without
* fee is hereby granted, provided that the above copyright
* notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting
* documentation, and that the name of M.I.T. not be used in
* advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is"
* without express or implied warranty.
*/
#include "ares_setup.h"
#include "ares_nowarn.h"
#if (SIZEOF_INT == 2)
# define CARES_MASK_SINT 0x7FFF
# define CARES_MASK_UINT 0xFFFF
#elif (SIZEOF_INT == 4)
# define CARES_MASK_SINT 0x7FFFFFFF
# define CARES_MASK_UINT 0xFFFFFFFF
#elif (SIZEOF_INT == 8)
# define CARES_MASK_SINT 0x7FFFFFFFFFFFFFFF
# define CARES_MASK_UINT 0xFFFFFFFFFFFFFFFF
#elif (SIZEOF_INT == 16)
# define CARES_MASK_SINT 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
# define CARES_MASK_UINT 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
#endif
/*
** size_t to signed int
*/
int aresx_uztosi(size_t uznum)
{
#ifdef __INTEL_COMPILER
# pragma warning(push)
# pragma warning(disable:810) /* conversion may lose significant bits */
#endif
return (int)(uznum & (size_t) CARES_MASK_SINT);
#ifdef __INTEL_COMPILER
# pragma warning(pop)
#endif
}
/*
** signed long to signed int
*/
int aresx_sltosi(long slnum)
{
#ifdef __INTEL_COMPILER
# pragma warning(push)
# pragma warning(disable:810) /* conversion may lose significant bits */
#endif
return (int)(slnum & (long) CARES_MASK_SINT);
#ifdef __INTEL_COMPILER
# pragma warning(pop)
#endif
}

24
deps/c-ares/ares_nowarn.h vendored Normal file
View File

@@ -0,0 +1,24 @@
#ifndef HEADER_CARES_NOWARN_H
#define HEADER_CARES_NOWARN_H
/* Copyright (C) 2010 by Daniel Stenberg
*
* Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without
* fee is hereby granted, provided that the above copyright
* notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting
* documentation, and that the name of M.I.T. not be used in
* advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is"
* without express or implied warranty.
*/
int aresx_uztosi(size_t uznum);
int aresx_sltosi(long slnum);
#endif /* HEADER_CARES_NOWARN_H */

253
deps/c-ares/ares_options.c vendored Normal file
View File

@@ -0,0 +1,253 @@
/* Copyright 1998 by the Massachusetts Institute of Technology.
* Copyright (C) 2008-2010 by Daniel Stenberg
*
* Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without
* fee is hereby granted, provided that the above copyright
* notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting
* documentation, and that the name of M.I.T. not be used in
* advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is"
* without express or implied warranty.
*/
#include "ares_setup.h"
#ifdef HAVE_ARPA_INET_H
# include <arpa/inet.h>
#endif
#include "ares.h"
#include "ares_data.h"
#include "inet_net_pton.h"
#include "ares_private.h"
int ares_get_servers(ares_channel channel,
struct ares_addr_node **servers)
{
struct ares_addr_node *srvr_head = NULL;
struct ares_addr_node *srvr_last = NULL;
struct ares_addr_node *srvr_curr;
int status = ARES_SUCCESS;
int i;
if (!channel)
return ARES_ENODATA;
for (i = 0; i < channel->nservers; i++)
{
/* Allocate storage for this server node appending it to the list */
srvr_curr = ares_malloc_data(ARES_DATATYPE_ADDR_NODE);
if (!srvr_curr)
{
status = ARES_ENOMEM;
break;
}
if (srvr_last)
{
srvr_last->next = srvr_curr;
}
else
{
srvr_head = srvr_curr;
}
srvr_last = srvr_curr;
/* Fill this server node data */
srvr_curr->family = channel->servers[i].addr.family;
if (srvr_curr->family == AF_INET)
memcpy(&srvr_curr->addrV4, &channel->servers[i].addr.addrV4,
sizeof(srvr_curr->addrV4));
else
memcpy(&srvr_curr->addrV6, &channel->servers[i].addr.addrV6,
sizeof(srvr_curr->addrV6));
}
if (status != ARES_SUCCESS)
{
if (srvr_head)
{
ares_free_data(srvr_head);
srvr_head = NULL;
}
}
*servers = srvr_head;
return status;
}
int ares_set_servers(ares_channel channel,
struct ares_addr_node *servers)
{
struct ares_addr_node *srvr;
int num_srvrs = 0;
int i;
if (ares_library_initialized() != ARES_SUCCESS)
return ARES_ENOTINITIALIZED;
if (!channel)
return ARES_ENODATA;
ares__destroy_servers_state(channel);
for (srvr = servers; srvr; srvr = srvr->next)
{
num_srvrs++;
}
if (num_srvrs > 0)
{
/* Allocate storage for servers state */
channel->servers = malloc(num_srvrs * sizeof(struct server_state));
if (!channel->servers)
{
return ARES_ENOMEM;
}
channel->nservers = num_srvrs;
/* Fill servers state address data */
for (i = 0, srvr = servers; srvr; i++, srvr = srvr->next)
{
channel->servers[i].addr.family = srvr->family;
if (srvr->family == AF_INET)
memcpy(&channel->servers[i].addr.addrV4, &srvr->addrV4,
sizeof(srvr->addrV4));
else
memcpy(&channel->servers[i].addr.addrV6, &srvr->addrV6,
sizeof(srvr->addrV6));
}
/* Initialize servers state remaining data */
ares__init_servers_state(channel);
}
return ARES_SUCCESS;
}
/* Incomming string format: host[:port][,host[:port]]... */
int ares_set_servers_csv(ares_channel channel,
const char* _csv)
{
int i;
char* csv = NULL;
char* ptr;
char* start_host;
long port;
bool found_port;
int rv = ARES_SUCCESS;
struct ares_addr_node *servers = NULL;
struct ares_addr_node *last = NULL;
if (ares_library_initialized() != ARES_SUCCESS)
return ARES_ENOTINITIALIZED;
if (!channel)
return ARES_ENODATA;
ares__destroy_servers_state(channel);
i = strlen(_csv);
if (i == 0)
return ARES_SUCCESS; /* blank all servers */
csv = malloc(i + 2);
strcpy(csv, _csv);
if (csv[i-1] != ',') { /* make parsing easier by ensuring ending ',' */
csv[i] = ',';
csv[i+1] = 0;
}
start_host = csv;
found_port = false;
for (ptr = csv; *ptr; ptr++) {
if (*ptr == ',') {
char* pp = ptr - 1;
struct in_addr in4;
struct ares_in6_addr in6;
struct ares_addr_node *s = NULL;
*ptr = 0; /* null terminate host:port string */
/* Got an entry..see if port was specified. */
while (pp > start_host) {
if (*pp == ':')
break; /* yes */
if (!ISDIGIT(*pp)) {
/* Found end of digits before we found :, so wasn't a port */
pp = ptr;
break;
}
pp--;
}
if ((pp != start_host) && ((pp + 1) < ptr)) {
/* Found it. */
found_port = true;
port = strtol(pp + 1, NULL, 10);
*pp = 0; /* null terminate host */
}
/* resolve host, try ipv4 first, rslt is in network byte order */
rv = ares_inet_pton(AF_INET, start_host, &in4);
if (!rv) {
/* Ok, try IPv6 then */
rv = ares_inet_pton(AF_INET6, start_host, &in6);
if (!rv) {
rv = ARES_EBADSTR;
goto out;
}
/* was ipv6, add new server */
s = malloc(sizeof(*s));
if (!s) {
rv = ARES_ENOMEM;
goto out;
}
s->family = AF_INET6;
memcpy(&s->addr, &in6, sizeof(struct ares_in6_addr));
}
else {
/* was ipv4, add new server */
s = malloc(sizeof(*s));
if (!s) {
rv = ARES_ENOMEM;
goto out;
}
s->family = AF_INET;
memcpy(&s->addr, &in4, sizeof(struct in_addr));
}
if (s) {
/* TODO: Add port to ares_addr_node and assign it here. */
s->next = NULL;
if (last) {
last->next = s;
}
else {
servers = s;
last = s;
}
}
/* Set up for next one */
found_port = false;
start_host = ptr + 1;
}
}
rv = ares_set_servers(channel, servers);
out:
if (csv)
free(csv);
while (servers) {
struct ares_addr_node *s = servers;
servers = servers->next;
free(s);
}
return rv;
}

258
deps/c-ares/ares_parse_a_reply.c vendored Normal file
View File

@@ -0,0 +1,258 @@
/* Copyright 1998 by the Massachusetts Institute of Technology.
*
* Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without
* fee is hereby granted, provided that the above copyright
* notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting
* documentation, and that the name of M.I.T. not be used in
* advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is"
* without express or implied warranty.
*/
#include "ares_setup.h"
#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
#ifdef HAVE_NETDB_H
# include <netdb.h>
#endif
#ifdef HAVE_ARPA_INET_H
# include <arpa/inet.h>
#endif
#ifdef HAVE_ARPA_NAMESER_H
# include <arpa/nameser.h>
#else
# include "nameser.h"
#endif
#ifdef HAVE_ARPA_NAMESER_COMPAT_H
# include <arpa/nameser_compat.h>
#endif
#ifdef HAVE_STRINGS_H
# include <strings.h>
#endif
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_LIMITS_H
# include <limits.h>
#endif
#include "ares.h"
#include "ares_dns.h"
#include "ares_private.h"
int ares_parse_a_reply(const unsigned char *abuf, int alen,
struct hostent **host,
struct ares_addrttl *addrttls, int *naddrttls)
{
unsigned int qdcount, ancount;
int status, i, rr_type, rr_class, rr_len, rr_ttl, naddrs;
int cname_ttl = INT_MAX; /* the TTL imposed by the CNAME chain */
int naliases;
long len;
const unsigned char *aptr;
char *hostname, *rr_name, *rr_data, **aliases;
struct in_addr *addrs;
struct hostent *hostent;
const int max_addr_ttls = (addrttls && naddrttls) ? *naddrttls : 0;
/* Set *host to NULL for all failure cases. */
if (host)
*host = NULL;
/* Same with *naddrttls. */
if (naddrttls)
*naddrttls = 0;
/* Give up if abuf doesn't have room for a header. */
if (alen < HFIXEDSZ)
return ARES_EBADRESP;
/* Fetch the question and answer count from the header. */
qdcount = DNS_HEADER_QDCOUNT(abuf);
ancount = DNS_HEADER_ANCOUNT(abuf);
if (qdcount != 1)
return ARES_EBADRESP;
/* Expand the name from the question, and skip past the question. */
aptr = abuf + HFIXEDSZ;
status = ares__expand_name_for_response(aptr, abuf, alen, &hostname, &len);
if (status != ARES_SUCCESS)
return status;
if (aptr + len + QFIXEDSZ > abuf + alen)
{
free(hostname);
return ARES_EBADRESP;
}
aptr += len + QFIXEDSZ;
if (host)
{
/* Allocate addresses and aliases; ancount gives an upper bound for
both. */
addrs = malloc(ancount * sizeof(struct in_addr));
if (!addrs)
{
free(hostname);
return ARES_ENOMEM;
}
aliases = malloc((ancount + 1) * sizeof(char *));
if (!aliases)
{
free(hostname);
free(addrs);
return ARES_ENOMEM;
}
}
else
{
addrs = NULL;
aliases = NULL;
}
naddrs = 0;
naliases = 0;
/* Examine each answer resource record (RR) in turn. */
for (i = 0; i < (int)ancount; i++)
{
/* Decode the RR up to the data field. */
status = ares__expand_name_for_response(aptr, abuf, alen, &rr_name, &len);
if (status != ARES_SUCCESS)
break;
aptr += len;
if (aptr + RRFIXEDSZ > abuf + alen)
{
status = ARES_EBADRESP;
break;
}
rr_type = DNS_RR_TYPE(aptr);
rr_class = DNS_RR_CLASS(aptr);
rr_len = DNS_RR_LEN(aptr);
rr_ttl = DNS_RR_TTL(aptr);
aptr += RRFIXEDSZ;
if (rr_class == C_IN && rr_type == T_A
&& rr_len == sizeof(struct in_addr)
&& strcasecmp(rr_name, hostname) == 0)
{
if (addrs)
{
if (aptr + sizeof(struct in_addr) > abuf + alen)
{
status = ARES_EBADRESP;
break;
}
memcpy(&addrs[naddrs], aptr, sizeof(struct in_addr));
}
if (naddrs < max_addr_ttls)
{
struct ares_addrttl * const at = &addrttls[naddrs];
if (aptr + sizeof(struct in_addr) > abuf + alen)
{
status = ARES_EBADRESP;
break;
}
memcpy(&at->ipaddr, aptr, sizeof(struct in_addr));
at->ttl = rr_ttl;
}
naddrs++;
status = ARES_SUCCESS;
}
if (rr_class == C_IN && rr_type == T_CNAME)
{
/* Record the RR name as an alias. */
if (aliases)
aliases[naliases] = rr_name;
else
free(rr_name);
naliases++;
/* Decode the RR data and replace the hostname with it. */
status = ares__expand_name_for_response(aptr, abuf, alen, &rr_data,
&len);
if (status != ARES_SUCCESS)
break;
free(hostname);
hostname = rr_data;
/* Take the min of the TTLs we see in the CNAME chain. */
if (cname_ttl > rr_ttl)
cname_ttl = rr_ttl;
}
else
free(rr_name);
aptr += rr_len;
if (aptr > abuf + alen)
{
status = ARES_EBADRESP;
break;
}
}
if (status == ARES_SUCCESS && naddrs == 0 && naliases == 0)
/* the check for naliases to be zero is to make sure CNAME responses
don't get caught here */
status = ARES_ENODATA;
if (status == ARES_SUCCESS)
{
/* We got our answer. */
if (naddrttls)
{
const int n = naddrs < max_addr_ttls ? naddrs : max_addr_ttls;
for (i = 0; i < n; i++)
{
/* Ensure that each A TTL is no larger than the CNAME TTL. */
if (addrttls[i].ttl > cname_ttl)
addrttls[i].ttl = cname_ttl;
}
*naddrttls = n;
}
if (aliases)
aliases[naliases] = NULL;
if (host)
{
/* Allocate memory to build the host entry. */
hostent = malloc(sizeof(struct hostent));
if (hostent)
{
hostent->h_addr_list = malloc((naddrs + 1) * sizeof(char *));
if (hostent->h_addr_list)
{
/* Fill in the hostent and return successfully. */
hostent->h_name = hostname;
hostent->h_aliases = aliases;
hostent->h_addrtype = AF_INET;
hostent->h_length = sizeof(struct in_addr);
for (i = 0; i < naddrs; i++)
hostent->h_addr_list[i] = (char *) &addrs[i];
hostent->h_addr_list[naddrs] = NULL;
*host = hostent;
return ARES_SUCCESS;
}
free(hostent);
}
status = ARES_ENOMEM;
}
}
if (aliases)
{
for (i = 0; i < naliases; i++)
free(aliases[i]);
free(aliases);
}
free(addrs);
free(hostname);
return status;
}

256
deps/c-ares/ares_parse_aaaa_reply.c vendored Normal file
View File

@@ -0,0 +1,256 @@
/* Copyright 1998 by the Massachusetts Institute of Technology.
* Copyright 2005 Dominick Meglio
*
* Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without
* fee is hereby granted, provided that the above copyright
* notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting
* documentation, and that the name of M.I.T. not be used in
* advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is"
* without express or implied warranty.
*/
#include "ares_setup.h"
#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
#ifdef HAVE_NETDB_H
# include <netdb.h>
#endif
#ifdef HAVE_ARPA_INET_H
# include <arpa/inet.h>
#endif
#ifdef HAVE_ARPA_NAMESER_H
# include <arpa/nameser.h>
#else
# include "nameser.h"
#endif
#ifdef HAVE_ARPA_NAMESER_COMPAT_H
# include <arpa/nameser_compat.h>
#endif
#ifdef HAVE_STRINGS_H
# include <strings.h>
#endif
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_LIMITS_H
# include <limits.h>
#endif
#include "ares.h"
#include "ares_dns.h"
#include "inet_net_pton.h"
#include "ares_private.h"
int ares_parse_aaaa_reply(const unsigned char *abuf, int alen,
struct hostent **host, struct ares_addr6ttl *addrttls,
int *naddrttls)
{
unsigned int qdcount, ancount;
int status, i, rr_type, rr_class, rr_len, rr_ttl, naddrs;
int cname_ttl = INT_MAX; /* the TTL imposed by the CNAME chain */
int naliases;
long len;
const unsigned char *aptr;
char *hostname, *rr_name, *rr_data, **aliases;
struct ares_in6_addr *addrs;
struct hostent *hostent;
const int max_addr_ttls = (addrttls && naddrttls) ? *naddrttls : 0;
/* Set *host to NULL for all failure cases. */
if (host)
*host = NULL;
/* Same with *naddrttls. */
if (naddrttls)
*naddrttls = 0;
/* Give up if abuf doesn't have room for a header. */
if (alen < HFIXEDSZ)
return ARES_EBADRESP;
/* Fetch the question and answer count from the header. */
qdcount = DNS_HEADER_QDCOUNT(abuf);
ancount = DNS_HEADER_ANCOUNT(abuf);
if (qdcount != 1)
return ARES_EBADRESP;
/* Expand the name from the question, and skip past the question. */
aptr = abuf + HFIXEDSZ;
status = ares__expand_name_for_response(aptr, abuf, alen, &hostname, &len);
if (status != ARES_SUCCESS)
return status;
if (aptr + len + QFIXEDSZ > abuf + alen)
{
free(hostname);
return ARES_EBADRESP;
}
aptr += len + QFIXEDSZ;
/* Allocate addresses and aliases; ancount gives an upper bound for both. */
if (host)
{
addrs = malloc(ancount * sizeof(struct ares_in6_addr));
if (!addrs)
{
free(hostname);
return ARES_ENOMEM;
}
aliases = malloc((ancount + 1) * sizeof(char *));
if (!aliases)
{
free(hostname);
free(addrs);
return ARES_ENOMEM;
}
}
else
{
addrs = NULL;
aliases = NULL;
}
naddrs = 0;
naliases = 0;
/* Examine each answer resource record (RR) in turn. */
for (i = 0; i < (int)ancount; i++)
{
/* Decode the RR up to the data field. */
status = ares__expand_name_for_response(aptr, abuf, alen, &rr_name, &len);
if (status != ARES_SUCCESS)
break;
aptr += len;
if (aptr + RRFIXEDSZ > abuf + alen)
{
status = ARES_EBADRESP;
break;
}
rr_type = DNS_RR_TYPE(aptr);
rr_class = DNS_RR_CLASS(aptr);
rr_len = DNS_RR_LEN(aptr);
rr_ttl = DNS_RR_TTL(aptr);
aptr += RRFIXEDSZ;
if (rr_class == C_IN && rr_type == T_AAAA
&& rr_len == sizeof(struct ares_in6_addr)
&& strcasecmp(rr_name, hostname) == 0)
{
if (addrs)
{
if (aptr + sizeof(struct ares_in6_addr) > abuf + alen)
{
status = ARES_EBADRESP;
break;
}
memcpy(&addrs[naddrs], aptr, sizeof(struct ares_in6_addr));
}
if (naddrs < max_addr_ttls)
{
struct ares_addr6ttl * const at = &addrttls[naddrs];
if (aptr + sizeof(struct ares_in6_addr) > abuf + alen)
{
status = ARES_EBADRESP;
break;
}
memcpy(&at->ip6addr, aptr, sizeof(struct ares_in6_addr));
at->ttl = rr_ttl;
}
naddrs++;
status = ARES_SUCCESS;
}
if (rr_class == C_IN && rr_type == T_CNAME)
{
/* Record the RR name as an alias. */
if (aliases)
aliases[naliases] = rr_name;
else
free(rr_name);
naliases++;
/* Decode the RR data and replace the hostname with it. */
status = ares__expand_name_for_response(aptr, abuf, alen, &rr_data,
&len);
if (status != ARES_SUCCESS)
break;
free(hostname);
hostname = rr_data;
/* Take the min of the TTLs we see in the CNAME chain. */
if (cname_ttl > rr_ttl)
cname_ttl = rr_ttl;
}
else
free(rr_name);
aptr += rr_len;
if (aptr > abuf + alen)
{
status = ARES_EBADRESP;
break;
}
}
if (status == ARES_SUCCESS && naddrs == 0)
status = ARES_ENODATA;
if (status == ARES_SUCCESS)
{
/* We got our answer. */
if (naddrttls)
{
const int n = naddrs < max_addr_ttls ? naddrs : max_addr_ttls;
for (i = 0; i < n; i++)
{
/* Ensure that each A TTL is no larger than the CNAME TTL. */
if (addrttls[i].ttl > cname_ttl)
addrttls[i].ttl = cname_ttl;
}
*naddrttls = n;
}
if (aliases)
aliases[naliases] = NULL;
if (host)
{
/* Allocate memory to build the host entry. */
hostent = malloc(sizeof(struct hostent));
if (hostent)
{
hostent->h_addr_list = malloc((naddrs + 1) * sizeof(char *));
if (hostent->h_addr_list)
{
/* Fill in the hostent and return successfully. */
hostent->h_name = hostname;
hostent->h_aliases = aliases;
hostent->h_addrtype = AF_INET6;
hostent->h_length = sizeof(struct ares_in6_addr);
for (i = 0; i < naddrs; i++)
hostent->h_addr_list[i] = (char *) &addrs[i];
hostent->h_addr_list[naddrs] = NULL;
*host = hostent;
return ARES_SUCCESS;
}
free(hostent);
}
status = ARES_ENOMEM;
}
}
if (aliases)
{
for (i = 0; i < naliases; i++)
free(aliases[i]);
free(aliases);
}
free(addrs);
free(hostname);
return status;
}

170
deps/c-ares/ares_parse_mx_reply.c vendored Normal file
View File

@@ -0,0 +1,170 @@
/* Copyright 1998 by the Massachusetts Institute of Technology.
* Copyright (C) 2010 Jeremy Lal <kapouer@melix.org>
*
* Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without
* fee is hereby granted, provided that the above copyright
* notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting
* documentation, and that the name of M.I.T. not be used in
* advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is"
* without express or implied warranty.
*/
#include "ares_setup.h"
#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
#ifdef HAVE_NETDB_H
# include <netdb.h>
#endif
#ifdef HAVE_ARPA_INET_H
# include <arpa/inet.h>
#endif
#ifdef HAVE_ARPA_NAMESER_H
# include <arpa/nameser.h>
#else
# include "nameser.h"
#endif
#ifdef HAVE_ARPA_NAMESER_COMPAT_H
# include <arpa/nameser_compat.h>
#endif
#include <stdlib.h>
#include <string.h>
#include "ares.h"
#include "ares_dns.h"
#include "ares_data.h"
#include "ares_private.h"
int
ares_parse_mx_reply (const unsigned char *abuf, int alen,
struct ares_mx_reply **mx_out)
{
unsigned int qdcount, ancount, i;
const unsigned char *aptr, *vptr;
int status, rr_type, rr_class, rr_len;
long len;
char *hostname = NULL, *rr_name = NULL;
struct ares_mx_reply *mx_head = NULL;
struct ares_mx_reply *mx_last = NULL;
struct ares_mx_reply *mx_curr;
/* Set *mx_out to NULL for all failure cases. */
*mx_out = NULL;
/* Give up if abuf doesn't have room for a header. */
if (alen < HFIXEDSZ)
return ARES_EBADRESP;
/* Fetch the question and answer count from the header. */
qdcount = DNS_HEADER_QDCOUNT (abuf);
ancount = DNS_HEADER_ANCOUNT (abuf);
if (qdcount != 1)
return ARES_EBADRESP;
if (ancount == 0)
return ARES_ENODATA;
/* Expand the name from the question, and skip past the question. */
aptr = abuf + HFIXEDSZ;
status = ares_expand_name (aptr, abuf, alen, &hostname, &len);
if (status != ARES_SUCCESS)
return status;
if (aptr + len + QFIXEDSZ > abuf + alen)
{
free (hostname);
return ARES_EBADRESP;
}
aptr += len + QFIXEDSZ;
/* Examine each answer resource record (RR) in turn. */
for (i = 0; i < ancount; i++)
{
/* Decode the RR up to the data field. */
status = ares_expand_name (aptr, abuf, alen, &rr_name, &len);
if (status != ARES_SUCCESS)
{
break;
}
aptr += len;
if (aptr + RRFIXEDSZ > abuf + alen)
{
status = ARES_EBADRESP;
break;
}
rr_type = DNS_RR_TYPE (aptr);
rr_class = DNS_RR_CLASS (aptr);
rr_len = DNS_RR_LEN (aptr);
aptr += RRFIXEDSZ;
/* Check if we are really looking at a MX record */
if (rr_class == C_IN && rr_type == T_MX)
{
/* parse the MX record itself */
if (rr_len < 2)
{
status = ARES_EBADRESP;
break;
}
/* Allocate storage for this MX answer appending it to the list */
mx_curr = ares_malloc_data(ARES_DATATYPE_MX_REPLY);
if (!mx_curr)
{
status = ARES_ENOMEM;
break;
}
if (mx_last)
{
mx_last->next = mx_curr;
}
else
{
mx_head = mx_curr;
}
mx_last = mx_curr;
vptr = aptr;
mx_curr->priority = ntohs (*((unsigned short *)vptr));
vptr += sizeof(unsigned short);
status = ares_expand_name (vptr, abuf, alen, &mx_curr->host, &len);
if (status != ARES_SUCCESS)
break;
}
/* Don't lose memory in the next iteration */
free (rr_name);
rr_name = NULL;
/* Move on to the next record */
aptr += rr_len;
}
if (hostname)
free (hostname);
if (rr_name)
free (rr_name);
/* clean up on error */
if (status != ARES_SUCCESS)
{
if (mx_head)
ares_free_data (mx_head);
return status;
}
/* everything looks fine, return the data */
*mx_out = mx_head;
return ARES_SUCCESS;
}

182
deps/c-ares/ares_parse_ns_reply.c vendored Normal file
View File

@@ -0,0 +1,182 @@
/* $Id */
/* Copyright 1998 by the Massachusetts Institute of Technology.
*
* Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without
* fee is hereby granted, provided that the above copyright
* notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting
* documentation, and that the name of M.I.T. not be used in
* advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is"
* without express or implied warranty.
*/
/*
* ares_parse_ns_reply created by Vlad Dinulescu <vlad.dinulescu@avira.com>
* on behalf of AVIRA Gmbh - http://www.avira.com
*/
#include "ares_setup.h"
#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
#ifdef HAVE_NETDB_H
# include <netdb.h>
#endif
#ifdef HAVE_ARPA_INET_H
# include <arpa/inet.h>
#endif
#ifdef HAVE_ARPA_NAMESER_H
# include <arpa/nameser.h>
#else
# include "nameser.h"
#endif
#ifdef HAVE_ARPA_NAMESER_COMPAT_H
# include <arpa/nameser_compat.h>
#endif
#include <stdlib.h>
#include <string.h>
#include "ares.h"
#include "ares_dns.h"
#include "ares_private.h"
int ares_parse_ns_reply( const unsigned char* abuf, int alen,
struct hostent** host )
{
unsigned int qdcount, ancount;
int status, i, rr_type, rr_class, rr_len;
int nameservers_num;
long len;
const unsigned char *aptr;
char* hostname, *rr_name, *rr_data, **nameservers;
struct hostent *hostent;
/* Set *host to NULL for all failure cases. */
*host = NULL;
/* Give up if abuf doesn't have room for a header. */
if ( alen < HFIXEDSZ )
return ARES_EBADRESP;
/* Fetch the question and answer count from the header. */
qdcount = DNS_HEADER_QDCOUNT( abuf );
ancount = DNS_HEADER_ANCOUNT( abuf );
if ( qdcount != 1 )
return ARES_EBADRESP;
/* Expand the name from the question, and skip past the question. */
aptr = abuf + HFIXEDSZ;
status = ares__expand_name_for_response( aptr, abuf, alen, &hostname, &len);
if ( status != ARES_SUCCESS )
return status;
if ( aptr + len + QFIXEDSZ > abuf + alen )
{
free( hostname );
return ARES_EBADRESP;
}
aptr += len + QFIXEDSZ;
/* Allocate nameservers array; ancount gives an upper bound */
nameservers = malloc( ( ancount + 1 ) * sizeof( char * ) );
if ( !nameservers )
{
free( hostname );
return ARES_ENOMEM;
}
nameservers_num = 0;
/* Examine each answer resource record (RR) in turn. */
for ( i = 0; i < ( int ) ancount; i++ )
{
/* Decode the RR up to the data field. */
status = ares__expand_name_for_response( aptr, abuf, alen, &rr_name, &len );
if ( status != ARES_SUCCESS )
break;
aptr += len;
if ( aptr + RRFIXEDSZ > abuf + alen )
{
status = ARES_EBADRESP;
break;
}
rr_type = DNS_RR_TYPE( aptr );
rr_class = DNS_RR_CLASS( aptr );
rr_len = DNS_RR_LEN( aptr );
aptr += RRFIXEDSZ;
if ( rr_class == C_IN && rr_type == T_NS )
{
/* Decode the RR data and add it to the nameservers list */
status = ares__expand_name_for_response( aptr, abuf, alen, &rr_data,
&len);
if ( status != ARES_SUCCESS )
{
break;
}
nameservers[nameservers_num] = malloc(strlen(rr_data)+1);
if (nameservers[nameservers_num]==NULL)
{
free(rr_name);
free(rr_data);
status=ARES_ENOMEM;
break;
}
strcpy(nameservers[nameservers_num],rr_data);
free(rr_data);
nameservers_num++;
}
free( rr_name );
aptr += rr_len;
if ( aptr > abuf + alen )
{
status = ARES_EBADRESP;
break;
}
}
if ( status == ARES_SUCCESS && nameservers_num == 0 )
{
status = ARES_ENODATA;
}
if ( status == ARES_SUCCESS )
{
/* We got our answer. Allocate memory to build the host entry. */
nameservers[nameservers_num] = NULL;
hostent = malloc( sizeof( struct hostent ) );
if ( hostent )
{
hostent->h_addr_list = malloc( 1 * sizeof( char * ) );
if ( hostent->h_addr_list )
{
/* Fill in the hostent and return successfully. */
hostent->h_name = hostname;
hostent->h_aliases = nameservers;
hostent->h_addrtype = AF_INET;
hostent->h_length = sizeof( struct in_addr );
hostent->h_addr_list[0] = NULL;
*host = hostent;
return ARES_SUCCESS;
}
free( hostent );
}
status = ARES_ENOMEM;
}
for ( i = 0; i < nameservers_num; i++ )
free( nameservers[i] );
free( nameservers );
free( hostname );
return status;
}

208
deps/c-ares/ares_parse_ptr_reply.c vendored Normal file
View File

@@ -0,0 +1,208 @@
/* Copyright 1998 by the Massachusetts Institute of Technology.
*
* Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without
* fee is hereby granted, provided that the above copyright
* notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting
* documentation, and that the name of M.I.T. not be used in
* advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is"
* without express or implied warranty.
*/
#include "ares_setup.h"
#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
#ifdef HAVE_NETDB_H
# include <netdb.h>
#endif
#ifdef HAVE_ARPA_NAMESER_H
# include <arpa/nameser.h>
#else
# include "nameser.h"
#endif
#ifdef HAVE_ARPA_NAMESER_COMPAT_H
# include <arpa/nameser_compat.h>
#endif
#ifdef HAVE_STRINGS_H
# include <strings.h>
#endif
#include <stdlib.h>
#include <string.h>
#include "ares.h"
#include "ares_dns.h"
#include "ares_private.h"
int ares_parse_ptr_reply(const unsigned char *abuf, int alen, const void *addr,
int addrlen, int family, struct hostent **host)
{
unsigned int qdcount, ancount;
int status, i, rr_type, rr_class, rr_len;
long len;
const unsigned char *aptr;
char *ptrname, *hostname, *rr_name, *rr_data;
struct hostent *hostent;
int aliascnt = 0;
int alias_alloc = 8;
char ** aliases;
/* Set *host to NULL for all failure cases. */
*host = NULL;
/* Give up if abuf doesn't have room for a header. */
if (alen < HFIXEDSZ)
return ARES_EBADRESP;
/* Fetch the question and answer count from the header. */
qdcount = DNS_HEADER_QDCOUNT(abuf);
ancount = DNS_HEADER_ANCOUNT(abuf);
if (qdcount != 1)
return ARES_EBADRESP;
/* Expand the name from the question, and skip past the question. */
aptr = abuf + HFIXEDSZ;
status = ares__expand_name_for_response(aptr, abuf, alen, &ptrname, &len);
if (status != ARES_SUCCESS)
return status;
if (aptr + len + QFIXEDSZ > abuf + alen)
{
free(ptrname);
return ARES_EBADRESP;
}
aptr += len + QFIXEDSZ;
/* Examine each answer resource record (RR) in turn. */
hostname = NULL;
aliases = malloc(alias_alloc * sizeof(char *));
if (!aliases)
{
free(ptrname);
return ARES_ENOMEM;
}
for (i = 0; i < (int)ancount; i++)
{
/* Decode the RR up to the data field. */
status = ares__expand_name_for_response(aptr, abuf, alen, &rr_name, &len);
if (status != ARES_SUCCESS)
break;
aptr += len;
if (aptr + RRFIXEDSZ > abuf + alen)
{
status = ARES_EBADRESP;
break;
}
rr_type = DNS_RR_TYPE(aptr);
rr_class = DNS_RR_CLASS(aptr);
rr_len = DNS_RR_LEN(aptr);
aptr += RRFIXEDSZ;
if (rr_class == C_IN && rr_type == T_PTR
&& strcasecmp(rr_name, ptrname) == 0)
{
/* Decode the RR data and set hostname to it. */
status = ares__expand_name_for_response(aptr, abuf, alen, &rr_data,
&len);
if (status != ARES_SUCCESS)
break;
if (hostname)
free(hostname);
hostname = rr_data;
aliases[aliascnt] = malloc((strlen(rr_data)+1) * sizeof(char *));
if (!aliases[aliascnt])
{
status = ARES_ENOMEM;
break;
}
strncpy(aliases[aliascnt], rr_data, strlen(rr_data)+1);
aliascnt++;
if (aliascnt >= alias_alloc) {
char **ptr;
alias_alloc *= 2;
ptr = realloc(aliases, alias_alloc * sizeof(char *));
if(!ptr) {
status = ARES_ENOMEM;
break;
}
aliases = ptr;
}
}
if (rr_class == C_IN && rr_type == T_CNAME)
{
/* Decode the RR data and replace ptrname with it. */
status = ares__expand_name_for_response(aptr, abuf, alen, &rr_data,
&len);
if (status != ARES_SUCCESS)
break;
free(ptrname);
ptrname = rr_data;
}
free(rr_name);
aptr += rr_len;
if (aptr > abuf + alen)
{
status = ARES_EBADRESP;
break;
}
}
if (status == ARES_SUCCESS && !hostname)
status = ARES_ENODATA;
if (status == ARES_SUCCESS)
{
/* We got our answer. Allocate memory to build the host entry. */
hostent = malloc(sizeof(struct hostent));
if (hostent)
{
hostent->h_addr_list = malloc(2 * sizeof(char *));
if (hostent->h_addr_list)
{
hostent->h_addr_list[0] = malloc(addrlen);
if (hostent->h_addr_list[0])
{
hostent->h_aliases = malloc((aliascnt+1) * sizeof (char *));
if (hostent->h_aliases)
{
/* Fill in the hostent and return successfully. */
hostent->h_name = hostname;
for (i=0 ; i<aliascnt ; i++)
hostent->h_aliases[i] = aliases[i];
hostent->h_aliases[aliascnt] = NULL;
hostent->h_addrtype = family;
hostent->h_length = addrlen;
memcpy(hostent->h_addr_list[0], addr, addrlen);
hostent->h_addr_list[1] = NULL;
*host = hostent;
free(aliases);
free(ptrname);
return ARES_SUCCESS;
}
free(hostent->h_addr_list[0]);
}
free(hostent->h_addr_list);
}
free(hostent);
}
status = ARES_ENOMEM;
}
for (i=0 ; i<aliascnt ; i++)
if (aliases[i])
free(aliases[i]);
free(aliases);
if (hostname)
free(hostname);
free(ptrname);
return status;
}

179
deps/c-ares/ares_parse_srv_reply.c vendored Normal file
View File

@@ -0,0 +1,179 @@
/* Copyright 1998 by the Massachusetts Institute of Technology.
* Copyright (C) 2009 by Jakub Hrozek <jhrozek@redhat.com>
*
* Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without
* fee is hereby granted, provided that the above copyright
* notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting
* documentation, and that the name of M.I.T. not be used in
* advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is"
* without express or implied warranty.
*/
#include "ares_setup.h"
#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
#ifdef HAVE_NETDB_H
# include <netdb.h>
#endif
#ifdef HAVE_ARPA_INET_H
# include <arpa/inet.h>
#endif
#ifdef HAVE_ARPA_NAMESER_H
# include <arpa/nameser.h>
#else
# include "nameser.h"
#endif
#ifdef HAVE_ARPA_NAMESER_COMPAT_H
# include <arpa/nameser_compat.h>
#endif
#include <stdlib.h>
#include <string.h>
#include "ares.h"
#include "ares_dns.h"
#include "ares_data.h"
#include "ares_private.h"
/* AIX portability check */
#ifndef T_SRV
# define T_SRV 33 /* server selection */
#endif
int
ares_parse_srv_reply (const unsigned char *abuf, int alen,
struct ares_srv_reply **srv_out)
{
unsigned int qdcount, ancount, i;
const unsigned char *aptr, *vptr;
int status, rr_type, rr_class, rr_len;
long len;
char *hostname = NULL, *rr_name = NULL;
struct ares_srv_reply *srv_head = NULL;
struct ares_srv_reply *srv_last = NULL;
struct ares_srv_reply *srv_curr;
/* Set *srv_out to NULL for all failure cases. */
*srv_out = NULL;
/* Give up if abuf doesn't have room for a header. */
if (alen < HFIXEDSZ)
return ARES_EBADRESP;
/* Fetch the question and answer count from the header. */
qdcount = DNS_HEADER_QDCOUNT (abuf);
ancount = DNS_HEADER_ANCOUNT (abuf);
if (qdcount != 1)
return ARES_EBADRESP;
if (ancount == 0)
return ARES_ENODATA;
/* Expand the name from the question, and skip past the question. */
aptr = abuf + HFIXEDSZ;
status = ares_expand_name (aptr, abuf, alen, &hostname, &len);
if (status != ARES_SUCCESS)
return status;
if (aptr + len + QFIXEDSZ > abuf + alen)
{
free (hostname);
return ARES_EBADRESP;
}
aptr += len + QFIXEDSZ;
/* Examine each answer resource record (RR) in turn. */
for (i = 0; i < ancount; i++)
{
/* Decode the RR up to the data field. */
status = ares_expand_name (aptr, abuf, alen, &rr_name, &len);
if (status != ARES_SUCCESS)
{
break;
}
aptr += len;
if (aptr + RRFIXEDSZ > abuf + alen)
{
status = ARES_EBADRESP;
break;
}
rr_type = DNS_RR_TYPE (aptr);
rr_class = DNS_RR_CLASS (aptr);
rr_len = DNS_RR_LEN (aptr);
aptr += RRFIXEDSZ;
/* Check if we are really looking at a SRV record */
if (rr_class == C_IN && rr_type == T_SRV)
{
/* parse the SRV record itself */
if (rr_len < 6)
{
status = ARES_EBADRESP;
break;
}
/* Allocate storage for this SRV answer appending it to the list */
srv_curr = ares_malloc_data(ARES_DATATYPE_SRV_REPLY);
if (!srv_curr)
{
status = ARES_ENOMEM;
break;
}
if (srv_last)
{
srv_last->next = srv_curr;
}
else
{
srv_head = srv_curr;
}
srv_last = srv_curr;
vptr = aptr;
srv_curr->priority = ntohs (*((unsigned short *)vptr));
vptr += sizeof(unsigned short);
srv_curr->weight = ntohs (*((unsigned short *)vptr));
vptr += sizeof(unsigned short);
srv_curr->port = ntohs (*((unsigned short *)vptr));
vptr += sizeof(unsigned short);
status = ares_expand_name (vptr, abuf, alen, &srv_curr->host, &len);
if (status != ARES_SUCCESS)
break;
}
/* Don't lose memory in the next iteration */
free (rr_name);
rr_name = NULL;
/* Move on to the next record */
aptr += rr_len;
}
if (hostname)
free (hostname);
if (rr_name)
free (rr_name);
/* clean up on error */
if (status != ARES_SUCCESS)
{
if (srv_head)
ares_free_data (srv_head);
return status;
}
/* everything looks fine, return the data */
*srv_out = srv_head;
return ARES_SUCCESS;
}

201
deps/c-ares/ares_parse_txt_reply.c vendored Normal file
View File

@@ -0,0 +1,201 @@
/* Copyright 1998 by the Massachusetts Institute of Technology.
* Copyright (C) 2009 by Jakub Hrozek <jhrozek@redhat.com>
*
* Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without
* fee is hereby granted, provided that the above copyright
* notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting
* documentation, and that the name of M.I.T. not be used in
* advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is"
* without express or implied warranty.
*/
#include "ares_setup.h"
#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
#ifdef HAVE_NETDB_H
# include <netdb.h>
#endif
#ifdef HAVE_ARPA_INET_H
# include <arpa/inet.h>
#endif
#ifdef HAVE_ARPA_NAMESER_H
# include <arpa/nameser.h>
#else
# include "nameser.h"
#endif
#ifdef HAVE_ARPA_NAMESER_COMPAT_H
# include <arpa/nameser_compat.h>
#endif
#ifdef HAVE_STRINGS_H
# include <strings.h>
#endif
#include <stdlib.h>
#include <string.h>
#include "ares.h"
#include "ares_dns.h"
#include "ares_data.h"
#include "ares_private.h"
int
ares_parse_txt_reply (const unsigned char *abuf, int alen,
struct ares_txt_reply **txt_out)
{
size_t substr_len, str_len;
unsigned int qdcount, ancount, i;
const unsigned char *aptr;
const unsigned char *strptr;
int status, rr_type, rr_class, rr_len;
long len;
char *hostname = NULL, *rr_name = NULL;
struct ares_txt_reply *txt_head = NULL;
struct ares_txt_reply *txt_last = NULL;
struct ares_txt_reply *txt_curr;
/* Set *txt_out to NULL for all failure cases. */
*txt_out = NULL;
/* Give up if abuf doesn't have room for a header. */
if (alen < HFIXEDSZ)
return ARES_EBADRESP;
/* Fetch the question and answer count from the header. */
qdcount = DNS_HEADER_QDCOUNT (abuf);
ancount = DNS_HEADER_ANCOUNT (abuf);
if (qdcount != 1)
return ARES_EBADRESP;
if (ancount == 0)
return ARES_ENODATA;
/* Expand the name from the question, and skip past the question. */
aptr = abuf + HFIXEDSZ;
status = ares_expand_name (aptr, abuf, alen, &hostname, &len);
if (status != ARES_SUCCESS)
return status;
if (aptr + len + QFIXEDSZ > abuf + alen)
{
free (hostname);
return ARES_EBADRESP;
}
aptr += len + QFIXEDSZ;
/* Examine each answer resource record (RR) in turn. */
for (i = 0; i < ancount; i++)
{
/* Decode the RR up to the data field. */
status = ares_expand_name (aptr, abuf, alen, &rr_name, &len);
if (status != ARES_SUCCESS)
{
break;
}
aptr += len;
if (aptr + RRFIXEDSZ > abuf + alen)
{
status = ARES_EBADRESP;
break;
}
rr_type = DNS_RR_TYPE (aptr);
rr_class = DNS_RR_CLASS (aptr);
rr_len = DNS_RR_LEN (aptr);
aptr += RRFIXEDSZ;
/* Check if we are really looking at a TXT record */
if (rr_class == C_IN && rr_type == T_TXT)
{
/* Allocate storage for this TXT answer appending it to the list */
txt_curr = ares_malloc_data(ARES_DATATYPE_TXT_REPLY);
if (!txt_curr)
{
status = ARES_ENOMEM;
break;
}
if (txt_last)
{
txt_last->next = txt_curr;
}
else
{
txt_head = txt_curr;
}
txt_last = txt_curr;
/*
* There may be multiple substrings in a single TXT record. Each
* substring may be up to 255 characters in length, with a
* "length byte" indicating the size of the substring payload.
* RDATA contains both the length-bytes and payloads of all
* substrings contained therein.
*/
/* Compute total length to allow a single memory allocation */
strptr = aptr;
while (strptr < (aptr + rr_len))
{
substr_len = (unsigned char)*strptr;
txt_curr->length += substr_len;
strptr += substr_len + 1;
}
/* Including null byte */
txt_curr->txt = malloc (txt_curr->length + 1);
if (txt_curr->txt == NULL)
{
status = ARES_ENOMEM;
break;
}
/* Step through the list of substrings, concatenating them */
str_len = 0;
strptr = aptr;
while (strptr < (aptr + rr_len))
{
substr_len = (unsigned char)*strptr;
strptr++;
memcpy ((char *) txt_curr->txt + str_len, strptr, substr_len);
str_len += substr_len;
strptr += substr_len;
}
/* Make sure we NULL-terminate */
*((char *) txt_curr->txt + txt_curr->length) = '\0';
}
/* Don't lose memory in the next iteration */
free (rr_name);
rr_name = NULL;
/* Move on to the next record */
aptr += rr_len;
}
if (hostname)
free (hostname);
if (rr_name)
free (rr_name);
/* clean up on error */
if (status != ARES_SUCCESS)
{
if (txt_head)
ares_free_data (txt_head);
return status;
}
/* everything looks fine, return the data */
*txt_out = txt_head;
return ARES_SUCCESS;
}

351
deps/c-ares/ares_private.h vendored Normal file
View File

@@ -0,0 +1,351 @@
#ifndef __ARES_PRIVATE_H
#define __ARES_PRIVATE_H
/* Copyright 1998 by the Massachusetts Institute of Technology.
* Copyright (C) 2004-2010 by Daniel Stenberg
*
* Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without
* fee is hereby granted, provided that the above copyright
* notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting
* documentation, and that the name of M.I.T. not be used in
* advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is"
* without express or implied warranty.
*/
/*
* Define WIN32 when build target is Win32 API
*/
#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32)
#define WIN32
#endif
#include <stdio.h>
#include <sys/types.h>
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#ifdef WATT32
#include <tcp.h>
#include <sys/ioctl.h>
#define writev(s,v,c) writev_s(s,v,c)
#define HAVE_WRITEV 1
#endif
#ifdef NETWARE
#include <time.h>
#endif
#define DEFAULT_TIMEOUT 5000 /* milliseconds */
#define DEFAULT_TRIES 4
#ifndef INADDR_NONE
#define INADDR_NONE 0xffffffff
#endif
#if defined(WIN32) && !defined(WATT32)
#define IS_NT() ((int)GetVersion() > 0)
#define WIN_NS_9X "System\\CurrentControlSet\\Services\\VxD\\MSTCP"
#define WIN_NS_NT_KEY "System\\CurrentControlSet\\Services\\Tcpip\\Parameters"
#define NAMESERVER "NameServer"
#define DHCPNAMESERVER "DhcpNameServer"
#define DATABASEPATH "DatabasePath"
#define WIN_PATH_HOSTS "\\hosts"
#elif defined(WATT32)
#define PATH_RESOLV_CONF "/dev/ENV/etc/resolv.conf"
#elif defined(NETWARE)
#define PATH_RESOLV_CONF "sys:/etc/resolv.cfg"
#define PATH_HOSTS "sys:/etc/hosts"
#elif defined(__riscos__)
#define PATH_HOSTS "InetDBase:Hosts"
#else
#define PATH_RESOLV_CONF "/etc/resolv.conf"
#ifdef ETC_INET
#define PATH_HOSTS "/etc/inet/hosts"
#else
#define PATH_HOSTS "/etc/hosts"
#endif
#endif
#define ARES_ID_KEY_LEN 31
#include "ares_ipv6.h"
#include "ares_llist.h"
#ifndef HAVE_STRDUP
# include "ares_strdup.h"
# define strdup(ptr) ares_strdup(ptr)
#endif
#ifndef HAVE_STRCASECMP
# include "ares_strcasecmp.h"
# define strcasecmp(p1,p2) ares_strcasecmp(p1,p2)
#endif
#ifndef HAVE_STRNCASECMP
# include "ares_strcasecmp.h"
# define strncasecmp(p1,p2,n) ares_strncasecmp(p1,p2,n)
#endif
#ifndef HAVE_WRITEV
# include "ares_writev.h"
# define writev(s,ptr,cnt) ares_writev(s,ptr,cnt)
#endif
struct ares_addr {
int family;
union {
struct in_addr addr4;
struct ares_in6_addr addr6;
} addr;
};
#define addrV4 addr.addr4
#define addrV6 addr.addr6
struct query;
struct send_request {
/* Remaining data to send */
const unsigned char *data;
size_t len;
/* The query for which we're sending this data */
struct query* owner_query;
/* The buffer we're using, if we have our own copy of the packet */
unsigned char *data_storage;
/* Next request in queue */
struct send_request *next;
};
struct server_state {
struct ares_addr addr;
ares_socket_t udp_socket;
ares_socket_t tcp_socket;
/* Mini-buffer for reading the length word */
unsigned char tcp_lenbuf[2];
int tcp_lenbuf_pos;
int tcp_length;
/* Buffer for reading actual TCP data */
unsigned char *tcp_buffer;
int tcp_buffer_pos;
/* TCP output queue */
struct send_request *qhead;
struct send_request *qtail;
/* Which incarnation of this connection is this? We don't want to
* retransmit requests into the very same socket, but if the server
* closes on us and we re-open the connection, then we do want to
* re-send. */
int tcp_connection_generation;
/* Circular, doubly-linked list of outstanding queries to this server */
struct list_node queries_to_server;
/* Link back to owning channel */
ares_channel channel;
/* Is this server broken? We mark connections as broken when a
* request that is queued for sending times out.
*/
int is_broken;
};
/* State to represent a DNS query */
struct query {
/* Query ID from qbuf, for faster lookup, and current timeout */
unsigned short qid;
struct timeval timeout;
/*
* Links for the doubly-linked lists in which we insert a query.
* These circular, doubly-linked lists that are hash-bucketed based
* the attributes we care about, help making most important
* operations O(1).
*/
struct list_node queries_by_qid; /* hopefully in same cache line as qid */
struct list_node queries_by_timeout;
struct list_node queries_to_server;
struct list_node all_queries;
/* Query buf with length at beginning, for TCP transmission */
unsigned char *tcpbuf;
int tcplen;
/* Arguments passed to ares_send() (qbuf points into tcpbuf) */
const unsigned char *qbuf;
int qlen;
ares_callback callback;
void *arg;
/* Query status */
int try; /* Number of times we tried this query already. */
int server; /* Server this query has last been sent to. */
struct query_server_info *server_info; /* per-server state */
int using_tcp;
int error_status;
int timeouts; /* number of timeouts we saw for this request */
};
/* Per-server state for a query */
struct query_server_info {
int skip_server; /* should we skip server, due to errors, etc? */
int tcp_connection_generation; /* into which TCP connection did we send? */
};
/* An IP address pattern; matches an IP address X if X & mask == addr */
#define PATTERN_MASK 0x1
#define PATTERN_CIDR 0x2
struct apattern {
union
{
struct in_addr addr4;
struct ares_in6_addr addr6;
} addr;
union
{
struct in_addr addr4;
struct ares_in6_addr addr6;
unsigned short bits;
} mask;
int family;
unsigned short type;
};
typedef struct rc4_key
{
unsigned char state[256];
unsigned char x;
unsigned char y;
} rc4_key;
struct ares_channeldata {
/* Configuration data */
int flags;
int timeout; /* in milliseconds */
int tries;
int ndots;
int rotate; /* if true, all servers specified are used */
int udp_port;
int tcp_port;
int socket_send_buffer_size;
int socket_receive_buffer_size;
char **domains;
int ndomains;
struct apattern *sortlist;
int nsort;
char *lookups;
/* For binding to local devices and/or IP addresses. Leave
* them null/zero for no binding.
*/
char local_dev_name[32];
unsigned int local_ip4;
unsigned char local_ip6[16];
int optmask; /* the option bitfield passed in at init time */
/* Server addresses and communications state */
struct server_state *servers;
int nservers;
/* ID to use for next query */
unsigned short next_id;
/* key to use when generating new ids */
rc4_key id_key;
/* Generation number to use for the next TCP socket open/close */
int tcp_connection_generation;
/* The time at which we last called process_timeouts(). Uses integer seconds
just to draw the line somewhere. */
time_t last_timeout_processed;
/* Last server we sent a query to. */
int last_server;
/* Circular, doubly-linked list of queries, bucketed various ways.... */
/* All active queries in a single list: */
struct list_node all_queries;
/* Queries bucketed by qid, for quickly dispatching DNS responses: */
#define ARES_QID_TABLE_SIZE 2048
struct list_node queries_by_qid[ARES_QID_TABLE_SIZE];
/* Queries bucketed by timeout, for quickly handling timeouts: */
#define ARES_TIMEOUT_TABLE_SIZE 1024
struct list_node queries_by_timeout[ARES_TIMEOUT_TABLE_SIZE];
ares_sock_state_cb sock_state_cb;
void *sock_state_cb_data;
ares_sock_create_callback sock_create_cb;
void *sock_create_cb_data;
};
/* return true if now is exactly check time or later */
int ares__timedout(struct timeval *now,
struct timeval *check);
/* add the specific number of milliseconds to the time in the first argument */
int ares__timeadd(struct timeval *now,
int millisecs);
/* return time offset between now and (future) check, in milliseconds */
long ares__timeoffset(struct timeval *now,
struct timeval *check);
/* returns ARES_SUCCESS if library has been initialized */
int ares_library_initialized(void);
void ares__rc4(rc4_key* key,unsigned char *buffer_ptr, int buffer_len);
void ares__send_query(ares_channel channel, struct query *query,
struct timeval *now);
void ares__close_sockets(ares_channel channel, struct server_state *server);
int ares__get_hostent(FILE *fp, int family, struct hostent **host);
int ares__read_line(FILE *fp, char **buf, size_t *bufsize);
void ares__free_query(struct query *query);
unsigned short ares__generate_new_id(rc4_key* key);
struct timeval ares__tvnow(void);
int ares__expand_name_for_response(const unsigned char *encoded,
const unsigned char *abuf, int alen,
char **s, long *enclen);
void ares__init_servers_state(ares_channel channel);
void ares__destroy_servers_state(ares_channel channel);
#if 0 /* Not used */
long ares__tvdiff(struct timeval t1, struct timeval t2);
#endif
#define ARES_SWAP_BYTE(a,b) \
{ unsigned char swapByte = *(a); *(a) = *(b); *(b) = swapByte; }
#define SOCK_STATE_CALLBACK(c, s, r, w) \
do { \
if ((c)->sock_state_cb) \
(c)->sock_state_cb((c)->sock_state_cb_data, (s), (r), (w)); \
} while (0)
#ifdef CURLDEBUG
/* This is low-level hard-hacking memory leak tracking and similar. Using the
libcurl lowlevel code from within library is ugly and only works when
c-ares is built and linked with a similarly curldebug-enabled libcurl,
but we do this anyway for convenience. */
#include "../lib/memdebug.h"
#endif
#endif /* __ARES_PRIVATE_H */

1296
deps/c-ares/ares_process.c vendored Normal file

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More