Created
September 6, 2011 05:50
-
-
Save seebees/1196692 to your computer and use it in GitHub Desktop.
things to talk about node http
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
//test | |
//get a request | |
var test = http.request(); | |
//cheat and push things into the buffer | |
test.output.push('some test data'); | |
test.output.push('more data'); | |
test.outputEncodings.push(); | |
test.outputEncodings.push(); | |
test.connection.emit('drain'); | |
process.nextTick(function () { | |
//check that output is empty | |
}); | |
/* | |
questions | |
1. Shouldn't there be only 1 "flush" function? i.e. have | |
_writeRaw call ._flush? Like, but not exactly: | |
if ((!this.output.length || this._flush() !== false) && | |
this.connection.writable) { | |
return this.connection.write(data, encoding); | |
else { | |
return this._buffer(data, encoding); | |
} | |
2. Shouldn't the flush loop be: | |
var l=this.output.length; | |
while (l--){ etc? (not that big a deal but... | |
3. should the file be normalized to .socket or .connection? | |
4. isn't all that needs to be done to deal with | |
the drain/stream thing in OutgoingMessage.prototype.assignSocket: | |
socket.on('drain', function() { | |
this._httpMessage._flush(); //since _flush will emit drain | |
); | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment