michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: 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: '\ michael@0:
\ michael@0: Outer POST data: '; michael@0: 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: body += michael@0: '\ michael@0: \ michael@0: