Fix wrong XML-RPC body length calculation method which results in SCGI calls failing when multibyte characters are included (#635)

This commit is contained in:
Crux
2018-03-14 12:19:09 +09:00
committed by John Furrow
parent fda1fa9a53
commit 293aa11d51
+2 -1
View File
@@ -33,11 +33,12 @@ const sendMethodCall = (methodName, parameters) => {
const deserializer = new Deserializer('utf8');
const stream = net.connect(connectMethod);
const xml = Serializer.serializeMethodCall(methodName, parameters);
const xmlLength = Buffer.byteLength(xml, 'utf8');
stream.setEncoding('UTF8');
const headerItems = [
`CONTENT_LENGTH${nullChar}${xml.length}${nullChar}`,
`CONTENT_LENGTH${nullChar}${xmlLength}${nullChar}`,
`SCGI${nullChar}1${nullChar}`
];