mirror of
https://github.com/nodejs/node.git
synced 2024-11-29 15:06:33 +01:00
Support old 'binary' encoding in net.js
This commit is contained in:
parent
663269f687
commit
139c91e892
@ -329,6 +329,9 @@ function initStream (self) {
|
||||
case 'ascii':
|
||||
string = recvBuffer.asciiSlice(start, end);
|
||||
break;
|
||||
case 'binary':
|
||||
string = recvBuffer.binarySlice(start, end);
|
||||
break;
|
||||
default:
|
||||
throw new Error('Unsupported encoding ' + self._encoding + '. Use Buffer');
|
||||
}
|
||||
@ -513,9 +516,12 @@ Stream.prototype.write = function (data, encoding) {
|
||||
var charsWritten;
|
||||
if (encoding == 'utf8') {
|
||||
recvBuffer.utf8Write(data, recvBuffer.used);
|
||||
} else {
|
||||
} else if (encoding == 'ascii') {
|
||||
// ascii
|
||||
recvBuffer.asciiWrite(data, recvBuffer.used);
|
||||
} else {
|
||||
// binary
|
||||
recvBuffer.binaryWrite(data, recvBuffer.used);
|
||||
}
|
||||
|
||||
buffer = recvBuffer;
|
||||
|
Loading…
Reference in New Issue
Block a user