This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var assert = require('assert'); | |
var net = require('net'); | |
var open = process.binding('fs').open; | |
var sendfile = process.binding('fs').sendfile; | |
if (process.argv.length < 4) { | |
console.error('usage: sendfile <port> <path>'); | |
process.exit(1); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define SET_CONST(target, e) \ | |
(target)->Set( \ | |
v8::String::NewSymbol(#e), \ | |
v8::Integer::New(e), \ | |
(v8::PropertyAttribute) (v8::ReadOnly | v8::DontDelete) \ | |
) | |
... | |
#ifdef EREMOTE |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs = require('fs'); | |
var in = fs.openSync('/path/to/file', 'r'); | |
var out = /* ... a net.Stream instance from somewhere ... */ | |
var sent = 0, err = 0; | |
do { | |
try { | |
err = fs.sendfileSync(out.fd, in.fd, sent, 0); | |
sent += err; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var sys = require('sys'); | |
var slice = function(b, off, len) { | |
var s = 7 - (off + len - 1); | |
b = b >>> s; | |
return b & ~(0xff << len); | |
}; | |
sys.puts(slice(0x12, 3, 2)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var HTTPParser = process.binding('http_parser').HTTPParser; | |
var net = require('net'); | |
var path = require('path'); | |
var sys = require('sys'); | |
var Worker = require('webworker/webworker').Worker; | |
var VHOSTS = ['foo.bar.com', 'baz.bizzle.com']; | |
var WORKERS = {}; | |
VHOSTS.forEach(function(vh) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% npm ls @installed | |
npm it worked if it ends with ok | |
npm sudo false | |
npm configfile /Users/griessp/.npmrc | |
npm cli [ 'ls', '@installed' ] | |
npm version 0.1.19 | |
npm GET / | |
[email protected] @active @installed @remote @stable @tag=latest @tag=stable | |
[email protected] @active @installed @remote @stable @tag=latest @tag=stable | |
[email protected] @installed @remote @stable @tag=latest @tag=stable |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
./cli.js --auto-activate always install npm@stable | |
npm it worked if it ends with ok | |
npm sudo true | |
npm configfile /Users/griessp/.npmrc | |
npm cli [ '--auto-activate', 'always', 'install', 'npm@stable' ] | |
npm version 0.1.19 | |
npm ! Error: ENOENT, No such file or directory | |
at node.js:255:9 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- 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. | |
--- | |
lib/net.js | 20 ++++++++++++++------ | |
1 files changed, 14 insertions(+), 6 deletions(-) | |
diff --git a/lib/net.js b/lib/net.js | |
index 24e1f7a..ac5f568 100644 | |
--- a/lib/net.js |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 189ecf32e2540fb8e8d251bef16795868af66323 Mon Sep 17 00:00:00 2001 | |
From: Peter Griess <[email protected]> | |
Date: Tue, 15 Jun 2010 12:35:49 -0500 | |
Subject: [PATCH] Support 'upgrade' event in HTTP client. | |
- Add a unit test for client HTTP upgrade. | |
- Move around unit tests for server HTTP upgrade. | |
--- | |
lib/http.js | 13 ++- | |
test/simple/test-http-upgrade-client.js | 79 +++++++++++++++ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lib/http.js b/lib/http.js | |
index 1cf9eca..e9d7c6a 100644 | |
--- a/lib/http.js | |
+++ b/lib/http.js | |
@@ -863,11 +863,18 @@ function Client ( ) { | |
self.destroy(ret); | |
} else if (parser.incoming && parser.incoming.upgrade) { | |
var bytesParsed = ret; | |
- var upgradeHead = d.slice(start + bytesParsed, end - start); | |
- parser.incoming.upgradeHead = upgradeHead; |