Skip to content

Instantly share code, notes, and snippets.

Avatar

Koichi Kobayashi koichik

  • Japan
View GitHub Profile
View child.js
var s = '';
for (var i = 0; i < 1E5; ++i) s += 'あ';
process.send(s);
View gist:2575536
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');
View gist:1434450
Filter Stream
+----------------+----------------+
--> | WritableStream | ReadableStream | -->
+----------------+----------------+
Duplex Stream
+----------------+
| ReadableStream | -->
@koichik
koichik / gist:1330016
Created Nov 1, 2011
test for 4d4900f
View gist:1330016
var assert = require('assert');
var N = 2;
var tickCount = 0;
var exceptionCount = 0;
function cb() {
++tickCount;
throw new Error();
}
@koichik
koichik / gist:1295138
Created Oct 18, 2011
string encoder/decoder as a filter
View gist:1295138
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 Oct 7, 2011
node-http-proxy test case for HTTP/1.0
View http10.js
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 Sep 29, 2011
プルリクエストを処理するときのチェックリスト
View gist:1250610

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

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

  • パッチは master 用か v0.4 用か? (master にリクエストされても v0.4 に適用できるならそうする)
  • パッチを確認するためのブランチを作る。
  • パッチを適用する。
  • ビルドしてテスト。
  • コミットログに Fixes #1234 と追記するなど。
View 0001-https-Fix-https2-breaks-compatibility-with-https1.patch
From 1c076172f7b72d06c0831679da997e8e18accfdc Mon Sep 17 00:00:00 2001
From: koichik <koichik@improvement.jp>
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(-)
View gist:1137067
cleartext cleartext
write() ↓ ↑ 'data'
+------------+ +---------------------------------------+
| | cleartext| _pending ↑ |
| |-------------| _pull() ↓ CleartextStream ↑ _push() |
| |pair |_puller() ↓ ↑ _pusher()|
| | +---------------------------------------+
| | clearIn ↓ ↑ clearOut
| | ssl+---------------------------------------+
| SecurePair |-------------| OpenSSL |
View gist:1133842
### 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
You can’t perform that action at this time.