Skip to content

Instantly share code, notes, and snippets.

var s = '';
for (var i = 0; i < 1E5; ++i) s += 'あ';
process.send(s);
@koichik
koichik / gist:2575536
Created May 2, 2012 09:33
reproduce @lorenwest of #2997
var net = require('net');
var http = require('http');
var server = net.createServer(function(socket) {
socket.write('HTTP/1.1 204 No Content\r\n\r\nNo Content');
}).listen(3000, function() {
var req = http.get({port: 3000}, function(res) {
console.log('got response', res.statusCode);
res.on('end', function() {
console.log('end response');
Filter Stream
+----------------+----------------+
--> | WritableStream | ReadableStream | -->
+----------------+----------------+
Duplex Stream
+----------------+
| ReadableStream | -->
@koichik
koichik / gist:1330016
Created November 1, 2011 05:48
test for 4d4900f
var assert = require('assert');
var N = 2;
var tickCount = 0;
var exceptionCount = 0;
function cb() {
++tickCount;
throw new Error();
}
@koichik
koichik / gist:1295138
Created October 18, 2011 10:42
string encoder/decoder as a filter
var stream = require('stream');
var util = require('util');
exports.utf8Decoder = function() {
return new Utf8Decoder();
};
exports.utf8Encoder = function() {
return new StringEncoder('utf8');
};
@koichik
koichik / http10.js
Created October 7, 2011 11:46
node-http-proxy test case for HTTP/1.0
var net = require('net');
var http = require('http');
var httpProxy = require('./node-http-proxy');
var server = http.createServer(function(req, res) {
res.write('Hello, ');
res.end('World\n');
});
server.listen(8000, 'localhost', function() {
var proxy = httpProxy.createServer(8000, 'localhost');
@koichik
koichik / gist:1250610
Created September 29, 2011 12:04
プルリクエストを処理するときのチェックリスト

プルリクエストを処理するときのチェックリスト

まずは内容を確認して、問題なさげなら試してみよう。

  • パッチは master 用か v0.4 用か? (master にリクエストされても v0.4 に適用できるならそうする)
  • パッチを確認するためのブランチを作る。
  • パッチを適用する。
  • ビルドしてテスト。
  • コミットログに Fixes #1234 と追記するなど。
From 1c076172f7b72d06c0831679da997e8e18accfdc Mon Sep 17 00:00:00 2001
From: koichik <[email protected]>
Date: Mon, 15 Aug 2011 17:33:34 +0900
Subject: [PATCH] https: Fix https2 breaks compatibility with https1
Fixes #1531.
---
lib/http2.js | 8 ++++++--
lib/https2.js | 16 +++++++++++++++-
2 files changed, 21 insertions(+), 3 deletions(-)
@koichik
koichik / gist:1137067
Created August 10, 2011 15:10
tls image
cleartext cleartext
write() ↓ ↑ 'data'
+------------+ +---------------------------------------+
| | cleartext| _pending ↑ |
| |-------------| _pull() ↓ CleartextStream ↑ _push() |
| |pair |_puller() ↓ ↑ _pusher()|
| | +---------------------------------------+
| | clearIn ↓ ↑ clearOut
| | ssl+---------------------------------------+
| SecurePair |-------------| OpenSSL |
@koichik
koichik / gist:1133842
Created August 9, 2011 11:55
tls.markdown
### tls.CleartextStream
This is a stream on top of the *Encrypted* stream.
This makes it possible to read/write an encrypted data as a cleartext data.
This instance implements a duplex Stream interfaces.
It has all the common stream methods and events.
#### cleartextStream.authorized