-
Notifications
You must be signed in to change notification settings - Fork 30.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tls_wrap: slice buffer properly in ClearOut
#4184
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,8 @@ var net = require('net'); | |
var options, a, b, portA, portB; | ||
var gotHello = false; | ||
|
||
var body = new Buffer(4000).fill('A'); | ||
|
||
options = { | ||
key: fs.readFileSync(path.join(common.fixturesDir, 'test_key.pem')), | ||
cert: fs.readFileSync(path.join(common.fixturesDir, 'test_cert.pem')) | ||
|
@@ -38,7 +40,7 @@ a = tls.createServer(options, function(socket) { | |
|
||
// the "target" server | ||
b = tls.createServer(options, function(socket) { | ||
socket.end('hello'); | ||
socket.end(body); | ||
}); | ||
|
||
process.on('exit', function() { | ||
|
@@ -60,7 +62,7 @@ a.listen(common.PORT, function() { | |
}); | ||
ssl.setEncoding('utf8'); | ||
ssl.once('data', function(data) { | ||
assert.equal('hello', data); | ||
assert.equal(body.toString(), data); | ||
gotHello = true; | ||
}); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't it be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Arghh... It should be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I said about There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you, @santigimeno . Please don't forget to cc me on that PR ;) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
ssl.on('end', function() { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it safe to assume the entire body will always come in one
data
event?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Argh, of course no.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed, thanks!