Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #include "nsISupports.idl" |
michael@0 | 7 | |
michael@0 | 8 | interface nsIInputStream; |
michael@0 | 9 | |
michael@0 | 10 | /** |
michael@0 | 11 | * nsIUploadChannel |
michael@0 | 12 | * |
michael@0 | 13 | * A channel may optionally implement this interface if it supports the |
michael@0 | 14 | * notion of uploading a data stream. The upload stream may only be set |
michael@0 | 15 | * prior to the invocation of asyncOpen on the channel. |
michael@0 | 16 | */ |
michael@0 | 17 | [scriptable, uuid(5cfe15bd-5adb-4a7f-9e55-4f5a67d15794)] |
michael@0 | 18 | interface nsIUploadChannel : nsISupports |
michael@0 | 19 | { |
michael@0 | 20 | /** |
michael@0 | 21 | * Sets a stream to be uploaded by this channel. |
michael@0 | 22 | * |
michael@0 | 23 | * Most implementations of this interface require that the stream: |
michael@0 | 24 | * (1) implement threadsafe addRef and release |
michael@0 | 25 | * (2) implement nsIInputStream::readSegments |
michael@0 | 26 | * (3) implement nsISeekableStream::seek |
michael@0 | 27 | * |
michael@0 | 28 | * History here is that we need to support both streams that already have |
michael@0 | 29 | * headers (e.g., Content-Type and Content-Length) information prepended to |
michael@0 | 30 | * the stream (by plugins) as well as clients (composer, uploading |
michael@0 | 31 | * application) that want to upload data streams without any knowledge of |
michael@0 | 32 | * protocol specifications. For this reason, we have a special meaning |
michael@0 | 33 | * for the aContentType parameter (see below). |
michael@0 | 34 | * |
michael@0 | 35 | * @param aStream |
michael@0 | 36 | * The stream to be uploaded by this channel. |
michael@0 | 37 | * @param aContentType |
michael@0 | 38 | * If aContentType is empty, the protocol will assume that no |
michael@0 | 39 | * content headers are to be added to the uploaded stream and that |
michael@0 | 40 | * any required headers are already encoded in the stream. In the |
michael@0 | 41 | * case of HTTP, if this parameter is non-empty, then its value will |
michael@0 | 42 | * replace any existing Content-Type header on the HTTP request. |
michael@0 | 43 | * In the case of FTP and FILE, this parameter is ignored. |
michael@0 | 44 | * @param aContentLength |
michael@0 | 45 | * A value of -1 indicates that the length of the stream should be |
michael@0 | 46 | * determined by calling the stream's |available| method. |
michael@0 | 47 | */ |
michael@0 | 48 | void setUploadStream(in nsIInputStream aStream, |
michael@0 | 49 | in ACString aContentType, |
michael@0 | 50 | in long long aContentLength); |
michael@0 | 51 | |
michael@0 | 52 | /** |
michael@0 | 53 | * Get the stream (to be) uploaded by this channel. |
michael@0 | 54 | */ |
michael@0 | 55 | readonly attribute nsIInputStream uploadStream; |
michael@0 | 56 | }; |