michael@0: /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 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: #include "nsISupports.idl" michael@0: michael@0: interface nsIInputStream; michael@0: michael@0: /** michael@0: * nsIUploadChannel michael@0: * michael@0: * A channel may optionally implement this interface if it supports the michael@0: * notion of uploading a data stream. The upload stream may only be set michael@0: * prior to the invocation of asyncOpen on the channel. michael@0: */ michael@0: [scriptable, uuid(5cfe15bd-5adb-4a7f-9e55-4f5a67d15794)] michael@0: interface nsIUploadChannel : nsISupports michael@0: { michael@0: /** michael@0: * Sets a stream to be uploaded by this channel. michael@0: * michael@0: * Most implementations of this interface require that the stream: michael@0: * (1) implement threadsafe addRef and release michael@0: * (2) implement nsIInputStream::readSegments michael@0: * (3) implement nsISeekableStream::seek michael@0: * michael@0: * History here is that we need to support both streams that already have michael@0: * headers (e.g., Content-Type and Content-Length) information prepended to michael@0: * the stream (by plugins) as well as clients (composer, uploading michael@0: * application) that want to upload data streams without any knowledge of michael@0: * protocol specifications. For this reason, we have a special meaning michael@0: * for the aContentType parameter (see below). michael@0: * michael@0: * @param aStream michael@0: * The stream to be uploaded by this channel. michael@0: * @param aContentType michael@0: * If aContentType is empty, the protocol will assume that no michael@0: * content headers are to be added to the uploaded stream and that michael@0: * any required headers are already encoded in the stream. In the michael@0: * case of HTTP, if this parameter is non-empty, then its value will michael@0: * replace any existing Content-Type header on the HTTP request. michael@0: * In the case of FTP and FILE, this parameter is ignored. michael@0: * @param aContentLength michael@0: * A value of -1 indicates that the length of the stream should be michael@0: * determined by calling the stream's |available| method. michael@0: */ michael@0: void setUploadStream(in nsIInputStream aStream, michael@0: in ACString aContentType, michael@0: in long long aContentLength); michael@0: michael@0: /** michael@0: * Get the stream (to be) uploaded by this channel. michael@0: */ michael@0: readonly attribute nsIInputStream uploadStream; michael@0: };