1 const CC = Components.Constructor;
2 const BinaryInputStream = CC(
3 "@mozilla.org/binaryinputstream;1",
4 "nsIBinaryInputStream",
7 const BinaryOutputStream = CC(
8 "@mozilla.org/binaryoutputstream;1",
9 "nsIBinaryOutputStream",
13 function handleRequest(request, response) {
14 var bodyStream = new BinaryInputStream(request.bodyInputStream);
17 while ((bodyAvail = bodyStream.available()) > 0) {
18 Array.prototype.push.apply(bodyBytes, bodyStream.readByteArray(bodyAvail));
21 var bos = new BinaryOutputStream(response.bodyOutputStream);
23 response.processAsync();
24 bos.writeByteArray(bodyBytes);