netwerk/base/public/nsIUploadChannel.idl

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/netwerk/base/public/nsIUploadChannel.idl	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,56 @@
     1.4 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#include "nsISupports.idl"
    1.10 +
    1.11 +interface nsIInputStream;
    1.12 +
    1.13 +/**
    1.14 + * nsIUploadChannel
    1.15 + *
    1.16 + * A channel may optionally implement this interface if it supports the
    1.17 + * notion of uploading a data stream.  The upload stream may only be set
    1.18 + * prior to the invocation of asyncOpen on the channel.
    1.19 + */
    1.20 +[scriptable, uuid(5cfe15bd-5adb-4a7f-9e55-4f5a67d15794)]
    1.21 +interface nsIUploadChannel : nsISupports
    1.22 +{
    1.23 +    /**
    1.24 +     * Sets a stream to be uploaded by this channel.
    1.25 +     *
    1.26 +     * Most implementations of this interface require that the stream:
    1.27 +     *   (1) implement threadsafe addRef and release
    1.28 +     *   (2) implement nsIInputStream::readSegments
    1.29 +     *   (3) implement nsISeekableStream::seek
    1.30 +     *
    1.31 +     * History here is that we need to support both streams that already have
    1.32 +     * headers (e.g., Content-Type and Content-Length) information prepended to
    1.33 +     * the stream (by plugins) as well as clients (composer, uploading
    1.34 +     * application) that want to upload data streams without any knowledge of
    1.35 +     * protocol specifications.  For this reason, we have a special meaning
    1.36 +     * for the aContentType parameter (see below).
    1.37 +     * 
    1.38 +     * @param aStream
    1.39 +     *        The stream to be uploaded by this channel.
    1.40 +     * @param aContentType
    1.41 +     *        If aContentType is empty, the protocol will assume that no
    1.42 +     *        content headers are to be added to the uploaded stream and that
    1.43 +     *        any required headers are already encoded in the stream.  In the
    1.44 +     *        case of HTTP, if this parameter is non-empty, then its value will
    1.45 +     *        replace any existing Content-Type header on the HTTP request.
    1.46 +     *        In the case of FTP and FILE, this parameter is ignored.
    1.47 +     * @param aContentLength
    1.48 +     *        A value of -1 indicates that the length of the stream should be
    1.49 +     *        determined by calling the stream's |available| method.
    1.50 +     */
    1.51 +    void setUploadStream(in nsIInputStream aStream,
    1.52 +                         in ACString aContentType,
    1.53 +                         in long long aContentLength);
    1.54 +
    1.55 +    /**
    1.56 +     * Get the stream (to be) uploaded by this channel.
    1.57 +     */
    1.58 +    readonly attribute nsIInputStream uploadStream;
    1.59 +};

mercurial