netwerk/base/public/nsIUploadChannel.idl

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

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

mercurial