PRINTF(("done reading data [read %u bytes]\n", givenCount - count));
    NS_IMETHOD OnDataAvailable(nsIChannel *channel, nsISupports *ctxt,                                nsIInputStream *inStr, PRUint32 sourceOffset,                                PRUint32 count) {        printf("receiving %d bytes\n", count);        char buf[256];        PRUint32 writeCount;        nsresult rv;        while (count > 0) {            PRUint32 amt = PR_MIN(count, 256);            PRUint32 readCount;            rv = inStr->Read(buf, amt, &readCount);            if (NS_FAILED(rv)) return rv;            NS_ASSERTION(readCount != 0, "premature EOF");            nsresult rv = mOut->Write(buf, readCount, &writeCount);            if (NS_FAILED(rv)) return rv;            NS_ASSERTION(writeCount == readCount, "failed to write all the data");            count -= readCount;            mTotal += readCount;        }        return NS_OK;    }