tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

nsIUploadChannel2.idl (2344B)


      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/. */
      5 
      6 #include "nsISupports.idl"
      7 
      8 interface nsIInputStream;
      9 interface nsIRunnable;
     10 
     11 [scriptable, uuid(2f712b52-19c5-4e0c-9e8f-b5c7c3b67049)]
     12 interface nsIUploadChannel2 : nsISupports
     13 {
     14    /**
     15     * Sets a stream to be uploaded by this channel with the specified
     16     * Content-Type and Content-Length header values.
     17     *
     18     * Most implementations of this interface require that the stream:
     19     *   (1) implement threadsafe addRef and release
     20     *   (2) implement nsIInputStream::readSegments
     21     *   (3) implement nsISeekableStream::seek
     22     *
     23     * @param aStream
     24     *        The stream to be uploaded by this channel.
     25     * @param aContentType
     26     *        This value will replace any existing Content-Type
     27     *        header on the HTTP request, regardless of whether
     28     *        or not its empty.
     29     * @param aContentLength
     30     *        A value of -1 indicates that the length of the stream should be
     31     *        determined by calling the stream's |available| method.
     32     * @param aMethod
     33     *        The HTTP request method to set on the stream.
     34     * @param aStreamHasHeaders
     35     *        True if the stream already contains headers for the HTTP request.
     36     */
     37    void explicitSetUploadStream(in nsIInputStream aStream,
     38                                 in ACString aContentType,
     39                                 in long long aContentLength,
     40                                 in ACString aMethod,
     41                                 in boolean aStreamHasHeaders);
     42 
     43    /**
     44     * Value of aStreamHasHeaders from the last successful call to
     45     * explicitSetUploadStream.  TRUE indicates the attached upload stream
     46     * contains request headers.
     47     */
     48    readonly attribute boolean uploadStreamHasHeaders;
     49 
     50    /**
     51     * Clones the upload stream.  May only be called in the parent process.
     52     * aContentLength could be -1 in case the size of the stream is unknown,
     53     * otherwise it will contain the known size of the stream.
     54     */
     55    [noscript]
     56    nsIInputStream cloneUploadStream(out long long aContentLength);
     57 };