1 const CC = Components.Constructor;
2 const BinaryInputStream = CC(
3 "@mozilla.org/binaryinputstream;1",
4 "nsIBinaryInputStream",
8 function handleRequest(request, response) {
9 response.setHeader("Content-Type", "text/plain", false);
11 var body = new BinaryInputStream(request.bodyInputStream);
15 while ((avail = body.available()) > 0) {
16 Array.prototype.push.apply(bytes, body.readByteArray(avail));
19 var data = String.fromCharCode.apply(null, bytes);
20 response.bodyOutputStream.write(data, data.length);