nsIUploadChannel.idl 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* ***** BEGIN LICENSE BLOCK *****
  3. * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  4. *
  5. * The contents of this file are subject to the Mozilla Public License Version
  6. * 1.1 (the "License"); you may not use this file except in compliance with
  7. * the License. You may obtain a copy of the License at
  8. * http://www.mozilla.org/MPL/
  9. *
  10. * Software distributed under the License is distributed on an "AS IS" basis,
  11. * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  12. * for the specific language governing rights and limitations under the
  13. * License.
  14. *
  15. * The Original Code is mozilla.org code.
  16. *
  17. * The Initial Developer of the Original Code is
  18. * Netscape Communications Corporation.
  19. * Portions created by the Initial Developer are Copyright (C) 1998
  20. * the Initial Developer. All Rights Reserved.
  21. *
  22. * Contributor(s):
  23. *
  24. * Alternatively, the contents of this file may be used under the terms of
  25. * either the GNU General Public License Version 2 or later (the "GPL"), or
  26. * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  27. * in which case the provisions of the GPL or the LGPL are applicable instead
  28. * of those above. If you wish to allow use of your version of this file only
  29. * under the terms of either the GPL or the LGPL, and not to allow others to
  30. * use your version of this file under the terms of the MPL, indicate your
  31. * decision by deleting the provisions above and replace them with the notice
  32. * and other provisions required by the GPL or the LGPL. If you do not delete
  33. * the provisions above, a recipient may use your version of this file under
  34. * the terms of any one of the MPL, the GPL or the LGPL.
  35. *
  36. * ***** END LICENSE BLOCK ***** */
  37. #include "nsISupports.idl"
  38. interface nsIInputStream;
  39. /**
  40. * nsIUploadChannel
  41. *
  42. * A channel may optionally implement this interface if it supports the
  43. * notion of uploading a data stream. The upload stream may only be set
  44. * prior to the invocation of asyncOpen on the channel.
  45. *
  46. * @status FROZEN
  47. */
  48. [scriptable, uuid(ddf633d8-e9a4-439d-ad88-de636fd9bb75)]
  49. interface nsIUploadChannel : nsISupports
  50. {
  51. /**
  52. * Sets a stream to be uploaded by this channel.
  53. *
  54. * Most implementations of this interface require that the stream:
  55. * (1) implement threadsafe addRef and release
  56. * (2) implement nsIInputStream::readSegments
  57. * (3) implement nsISeekableStream::seek
  58. *
  59. * History here is that we need to support both streams that already have
  60. * headers (e.g., Content-Type and Content-Length) information prepended to
  61. * the stream (by plugins) as well as clients (composer, uploading
  62. * application) that want to upload data streams without any knowledge of
  63. * protocol specifications. For this reason, we have a special meaning
  64. * for the aContentType parameter (see below).
  65. *
  66. * @param aStream
  67. * The stream to be uploaded by this channel.
  68. * @param aContentType
  69. * If aContentType is empty, the protocol will assume that no
  70. * content headers are to be added to the uploaded stream and that
  71. * any required headers are already encoded in the stream. In the
  72. * case of HTTP, if this parameter is non-empty, then its value will
  73. * replace any existing Content-Type header on the HTTP request.
  74. * In the case of FTP and FILE, this parameter is ignored.
  75. * @param aContentLength
  76. * A value of -1 indicates that the length of the stream should be
  77. * determined by calling the stream's |available| method.
  78. */
  79. void setUploadStream(in nsIInputStream aStream,
  80. in ACString aContentType,
  81. in long aContentLength);
  82. /**
  83. * Get the stream (to be) uploaded by this channel.
  84. */
  85. readonly attribute nsIInputStream uploadStream;
  86. };