michael@0: const CC = Components.Constructor; michael@0: const BinaryInputStream = CC("@mozilla.org/binaryinputstream;1", michael@0: "nsIBinaryInputStream", michael@0: "setInputStream"); michael@0: michael@0: function handleRequest(request, response) michael@0: { michael@0: var body = ""; michael@0: var bodyStream = new BinaryInputStream(request.bodyInputStream); michael@0: var bytes = [], avail = 0; michael@0: while ((avail = bodyStream.available()) > 0) michael@0: body += String.fromCharCode.apply(String, bodyStream.readByteArray(avail)); michael@0: michael@0: response.setHeader("Content-Type", "text/html", false); michael@0: response.write(body); michael@0: } michael@0: