2001-09-29 00:14:13 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
1999-11-01 23:48:12 +03:00
|
|
|
*
|
2001-09-29 00:14:13 +04:00
|
|
|
* The contents of this file are subject to the Netscape Public License
|
|
|
|
* Version 1.1 (the "License"); you may not use this file except in
|
|
|
|
* compliance with the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/NPL/
|
1999-11-01 23:48:12 +03:00
|
|
|
*
|
2001-09-29 00:14:13 +04:00
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
1999-11-01 23:48:12 +03:00
|
|
|
*
|
1999-11-06 06:40:37 +03:00
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
2001-09-29 00:14:13 +04:00
|
|
|
* The Initial Developer of the Original Code is
|
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
1999-11-06 06:40:37 +03:00
|
|
|
*
|
2001-09-29 00:14:13 +04:00
|
|
|
* Contributor(s):
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
|
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
|
|
* use your version of this file under the terms of the NPL, indicate your
|
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
|
|
|
* the terms of any one of the NPL, the GPL or the LGPL.
|
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
1999-11-01 23:48:12 +03:00
|
|
|
|
|
|
|
#ifndef nsNetUtil_h__
|
|
|
|
#define nsNetUtil_h__
|
|
|
|
|
|
|
|
#include "nsIURI.h"
|
|
|
|
#include "netCore.h"
|
|
|
|
#include "nsIInputStream.h"
|
2001-01-24 01:10:34 +03:00
|
|
|
#include "nsIOutputStream.h"
|
1999-11-01 23:48:12 +03:00
|
|
|
#include "nsIStreamListener.h"
|
2001-01-24 01:10:34 +03:00
|
|
|
#include "nsIStreamProvider.h"
|
2001-04-10 10:01:08 +04:00
|
|
|
#include "nsIRequestObserverProxy.h"
|
1999-11-01 23:48:12 +03:00
|
|
|
#include "nsILoadGroup.h"
|
1999-11-18 10:36:41 +03:00
|
|
|
#include "nsIInterfaceRequestor.h"
|
2001-09-06 01:28:38 +04:00
|
|
|
#include "nsIInterfaceRequestorUtils.h"
|
1999-11-01 23:48:12 +03:00
|
|
|
#include "nsString.h"
|
2000-08-23 21:27:06 +04:00
|
|
|
#include "nsReadableUtils.h"
|
1999-11-01 23:48:12 +03:00
|
|
|
#include "nsIIOService.h"
|
|
|
|
#include "nsIServiceManager.h"
|
|
|
|
#include "nsIChannel.h"
|
2001-03-13 01:41:28 +03:00
|
|
|
#include "nsIStreamIOChannel.h"
|
2001-02-21 23:38:08 +03:00
|
|
|
#include "nsITransport.h"
|
2000-06-03 13:46:12 +04:00
|
|
|
#include "nsMemory.h"
|
1999-11-01 23:48:12 +03:00
|
|
|
#include "nsCOMPtr.h"
|
2000-09-15 23:27:05 +04:00
|
|
|
#include "nsIDownloader.h"
|
2000-02-03 02:04:47 +03:00
|
|
|
#include "nsIStreamLoader.h"
|
2000-04-13 13:20:50 +04:00
|
|
|
#include "nsIStreamIO.h"
|
2001-01-24 01:10:34 +03:00
|
|
|
#include "nsIPipe.h"
|
2001-05-12 01:04:09 +04:00
|
|
|
#include "nsIProtocolHandler.h"
|
|
|
|
#include "nsIStringStream.h"
|
|
|
|
#include "nsILocalFile.h"
|
|
|
|
#include "nsIFileStreams.h"
|
2000-04-13 13:20:50 +04:00
|
|
|
#include "nsXPIDLString.h"
|
2001-09-13 06:21:05 +04:00
|
|
|
#include "nsIProtocolProxyService.h"
|
2000-03-29 07:58:50 +04:00
|
|
|
#include "prio.h" // for read/write flags, permissions, etc.
|
1999-11-01 23:48:12 +03:00
|
|
|
|
2001-01-24 01:10:34 +03:00
|
|
|
#include "nsNetCID.h"
|
|
|
|
|
2000-09-09 03:31:26 +04:00
|
|
|
// Helper, to simplify getting the I/O service.
|
|
|
|
inline const nsGetServiceByCID
|
|
|
|
do_GetIOService(nsresult* error = 0)
|
|
|
|
{
|
|
|
|
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
|
|
|
|
return nsGetServiceByCID(kIOServiceCID, 0, error);
|
|
|
|
}
|
|
|
|
|
1999-11-01 23:48:12 +03:00
|
|
|
inline nsresult
|
2000-03-29 07:58:50 +04:00
|
|
|
NS_NewURI(nsIURI* *result,
|
|
|
|
const char* spec,
|
|
|
|
nsIURI* baseURI = nsnull,
|
|
|
|
nsIIOService* ioService = nsnull) // pass in nsIIOService to optimize callers
|
1999-11-01 23:48:12 +03:00
|
|
|
{
|
|
|
|
nsresult rv;
|
2000-03-29 07:58:50 +04:00
|
|
|
|
2000-09-09 03:31:26 +04:00
|
|
|
nsCOMPtr<nsIIOService> serv;
|
|
|
|
if (ioService == nsnull) {
|
|
|
|
serv = do_GetIOService(&rv);
|
2000-03-29 07:58:50 +04:00
|
|
|
if (NS_FAILED(rv)) return rv;
|
2000-09-09 03:31:26 +04:00
|
|
|
ioService = serv.get();
|
2000-03-29 07:58:50 +04:00
|
|
|
}
|
|
|
|
|
2000-09-09 03:31:26 +04:00
|
|
|
return ioService->NewURI(spec, baseURI, result);
|
1999-11-01 23:48:12 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
inline nsresult
|
2000-03-29 07:58:50 +04:00
|
|
|
NS_NewURI(nsIURI* *result,
|
2000-08-23 21:27:06 +04:00
|
|
|
const nsAReadableString& spec,
|
2000-03-29 07:58:50 +04:00
|
|
|
nsIURI* baseURI = nsnull,
|
|
|
|
nsIIOService* ioService = nsnull) // pass in nsIIOService to optimize callers
|
1999-11-01 23:48:12 +03:00
|
|
|
{
|
2001-11-16 11:23:28 +03:00
|
|
|
NS_ConvertUCS2toUTF8 specStr(spec); // this forces a single byte char*
|
|
|
|
if (!spec.IsEmpty() && specStr.IsEmpty())
|
1999-11-01 23:48:12 +03:00
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
2001-11-16 11:23:28 +03:00
|
|
|
return NS_NewURI(result, specStr.get(), baseURI, ioService);
|
1999-11-01 23:48:12 +03:00
|
|
|
}
|
|
|
|
|
2001-06-22 02:02:47 +04:00
|
|
|
|
|
|
|
inline nsresult
|
|
|
|
NS_NewFileURI(nsIURI* *result,
|
|
|
|
nsIFile* spec,
|
|
|
|
nsIIOService* ioService = nsnull) // pass in nsIIOService to optimize callers
|
|
|
|
{
|
|
|
|
nsresult rv;
|
|
|
|
|
|
|
|
nsCOMPtr<nsIIOService> serv;
|
|
|
|
if (ioService == nsnull) {
|
|
|
|
serv = do_GetIOService(&rv);
|
|
|
|
if (NS_FAILED(rv)) return rv;
|
|
|
|
ioService = serv.get();
|
|
|
|
}
|
|
|
|
|
|
|
|
return ioService->NewFileURI(spec, result);
|
|
|
|
}
|
|
|
|
|
1999-11-01 23:48:12 +03:00
|
|
|
inline nsresult
|
2000-03-29 07:58:50 +04:00
|
|
|
NS_OpenURI(nsIChannel* *result,
|
|
|
|
nsIURI* uri,
|
|
|
|
nsIIOService* ioService = nsnull, // pass in nsIIOService to optimize callers
|
|
|
|
nsILoadGroup* loadGroup = nsnull,
|
|
|
|
nsIInterfaceRequestor* notificationCallbacks = nsnull,
|
2001-04-10 10:01:08 +04:00
|
|
|
nsLoadFlags loadAttributes = NS_STATIC_CAST(nsLoadFlags, nsIRequest::LOAD_NORMAL))
|
1999-11-01 23:48:12 +03:00
|
|
|
{
|
|
|
|
nsresult rv;
|
2000-03-29 07:58:50 +04:00
|
|
|
|
2000-09-09 03:31:26 +04:00
|
|
|
nsCOMPtr<nsIIOService> serv;
|
|
|
|
if (ioService == nsnull) {
|
|
|
|
serv = do_GetIOService(&rv);
|
2000-03-29 07:58:50 +04:00
|
|
|
if (NS_FAILED(rv)) return rv;
|
2000-09-09 03:31:26 +04:00
|
|
|
ioService = serv.get();
|
2000-03-29 07:58:50 +04:00
|
|
|
}
|
1999-11-01 23:48:12 +03:00
|
|
|
|
2000-03-29 07:58:50 +04:00
|
|
|
nsIChannel* channel = nsnull;
|
2000-09-09 03:31:26 +04:00
|
|
|
rv = ioService->NewChannelFromURI(uri, &channel);
|
1999-11-01 23:48:12 +03:00
|
|
|
if (NS_FAILED(rv)) return rv;
|
|
|
|
|
2000-03-29 07:58:50 +04:00
|
|
|
if (loadGroup) {
|
|
|
|
rv = channel->SetLoadGroup(loadGroup);
|
|
|
|
if (NS_FAILED(rv)) return rv;
|
|
|
|
}
|
|
|
|
if (notificationCallbacks) {
|
|
|
|
rv = channel->SetNotificationCallbacks(notificationCallbacks);
|
|
|
|
if (NS_FAILED(rv)) return rv;
|
|
|
|
}
|
2001-04-10 10:01:08 +04:00
|
|
|
if (loadAttributes != nsIRequest::LOAD_NORMAL) {
|
|
|
|
rv = channel->SetLoadFlags(loadAttributes);
|
2000-03-29 07:58:50 +04:00
|
|
|
if (NS_FAILED(rv)) return rv;
|
|
|
|
}
|
|
|
|
|
1999-11-01 23:48:12 +03:00
|
|
|
*result = channel;
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
2000-02-03 02:04:47 +03:00
|
|
|
// Use this function with CAUTION. And do not use it on
|
|
|
|
// the UI thread. It creates a stream that blocks when
|
|
|
|
// you Read() from it and blocking the UI thread is
|
|
|
|
// illegal. If you don't want to implement a full
|
|
|
|
// blown asyncrhonous consumer (via nsIStreamListener)
|
|
|
|
// look at nsIStreamLoader instead.
|
1999-11-01 23:48:12 +03:00
|
|
|
inline nsresult
|
2000-03-29 07:58:50 +04:00
|
|
|
NS_OpenURI(nsIInputStream* *result,
|
|
|
|
nsIURI* uri,
|
|
|
|
nsIIOService* ioService = nsnull, // pass in nsIIOService to optimize callers
|
|
|
|
nsILoadGroup* loadGroup = nsnull,
|
|
|
|
nsIInterfaceRequestor* notificationCallbacks = nsnull,
|
2001-04-10 10:01:08 +04:00
|
|
|
nsLoadFlags loadAttributes = NS_STATIC_CAST(nsLoadFlags, nsIRequest::LOAD_NORMAL))
|
1999-11-01 23:48:12 +03:00
|
|
|
{
|
|
|
|
nsresult rv;
|
2000-03-29 07:58:50 +04:00
|
|
|
nsCOMPtr<nsIChannel> channel;
|
1999-11-01 23:48:12 +03:00
|
|
|
|
2000-03-29 07:58:50 +04:00
|
|
|
rv = NS_OpenURI(getter_AddRefs(channel), uri, ioService,
|
2001-02-21 23:38:08 +03:00
|
|
|
loadGroup, notificationCallbacks, loadAttributes);
|
1999-11-01 23:48:12 +03:00
|
|
|
if (NS_FAILED(rv)) return rv;
|
|
|
|
|
|
|
|
nsIInputStream* inStr;
|
2001-02-21 23:38:08 +03:00
|
|
|
rv = channel->Open(&inStr);
|
1999-11-01 23:48:12 +03:00
|
|
|
if (NS_FAILED(rv)) return rv;
|
|
|
|
|
|
|
|
*result = inStr;
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline nsresult
|
2000-03-29 07:58:50 +04:00
|
|
|
NS_OpenURI(nsIStreamListener* aConsumer,
|
|
|
|
nsISupports* context,
|
|
|
|
nsIURI* uri,
|
|
|
|
nsIIOService* ioService = nsnull, // pass in nsIIOService to optimize callers
|
|
|
|
nsILoadGroup* loadGroup = nsnull,
|
|
|
|
nsIInterfaceRequestor* notificationCallbacks = nsnull,
|
2001-04-10 10:01:08 +04:00
|
|
|
nsLoadFlags loadAttributes = NS_STATIC_CAST(nsLoadFlags, nsIRequest::LOAD_NORMAL))
|
1999-11-01 23:48:12 +03:00
|
|
|
{
|
|
|
|
nsresult rv;
|
2000-03-29 07:58:50 +04:00
|
|
|
nsCOMPtr<nsIChannel> channel;
|
1999-11-01 23:48:12 +03:00
|
|
|
|
2000-03-29 07:58:50 +04:00
|
|
|
rv = NS_OpenURI(getter_AddRefs(channel), uri, ioService,
|
2001-02-21 23:38:08 +03:00
|
|
|
loadGroup, notificationCallbacks, loadAttributes);
|
1999-11-01 23:48:12 +03:00
|
|
|
if (NS_FAILED(rv)) return rv;
|
|
|
|
|
2001-02-21 23:38:08 +03:00
|
|
|
rv = channel->AsyncOpen(aConsumer, context);
|
1999-11-01 23:48:12 +03:00
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline nsresult
|
2000-03-29 07:58:50 +04:00
|
|
|
NS_MakeAbsoluteURI(char* *result,
|
|
|
|
const char* spec,
|
|
|
|
nsIURI* baseURI = nsnull,
|
|
|
|
nsIIOService* ioService = nsnull) // pass in nsIIOService to optimize callers
|
1999-11-01 23:48:12 +03:00
|
|
|
{
|
1999-11-30 07:50:42 +03:00
|
|
|
NS_ASSERTION(baseURI, "It doesn't make sense to not supply a base URI");
|
|
|
|
|
|
|
|
if (spec == nsnull)
|
|
|
|
return baseURI->GetSpec(result);
|
2000-03-29 07:58:50 +04:00
|
|
|
|
2000-05-07 15:04:33 +04:00
|
|
|
return baseURI->Resolve(spec, result);
|
1999-11-01 23:48:12 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
inline nsresult
|
2000-08-23 21:27:06 +04:00
|
|
|
NS_MakeAbsoluteURI(nsAWritableString& result,
|
|
|
|
const nsAReadableString& spec,
|
2000-03-29 07:58:50 +04:00
|
|
|
nsIURI* baseURI = nsnull,
|
|
|
|
nsIIOService* ioService = nsnull) // pass in nsIIOService to optimize callers
|
1999-11-01 23:48:12 +03:00
|
|
|
{
|
|
|
|
char* resultStr;
|
2000-08-23 21:27:06 +04:00
|
|
|
char* specStr = ToNewUTF8String(spec);
|
1999-11-01 23:48:12 +03:00
|
|
|
if (!specStr) {
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
2000-03-29 07:58:50 +04:00
|
|
|
nsresult rv = NS_MakeAbsoluteURI(&resultStr, specStr, baseURI, ioService);
|
2000-06-03 13:46:12 +04:00
|
|
|
nsMemory::Free(specStr);
|
1999-11-01 23:48:12 +03:00
|
|
|
if (NS_FAILED(rv)) return rv;
|
|
|
|
|
2000-06-23 03:53:21 +04:00
|
|
|
result.Assign(NS_ConvertUTF8toUCS2(resultStr));
|
|
|
|
|
2000-06-03 13:46:12 +04:00
|
|
|
nsMemory::Free(resultStr);
|
1999-11-01 23:48:12 +03:00
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline nsresult
|
2000-03-29 07:58:50 +04:00
|
|
|
NS_NewPostDataStream(nsIInputStream **result,
|
|
|
|
PRBool isFile,
|
|
|
|
const char *data,
|
|
|
|
PRUint32 encodeFlags,
|
|
|
|
nsIIOService* ioService = nsnull) // pass in nsIIOService to optimize callers
|
1999-11-01 23:48:12 +03:00
|
|
|
{
|
|
|
|
nsresult rv;
|
2000-03-29 07:58:50 +04:00
|
|
|
|
2001-05-12 01:04:09 +04:00
|
|
|
if (isFile) {
|
|
|
|
nsCOMPtr<nsILocalFile> file;
|
2001-05-14 14:20:46 +04:00
|
|
|
nsCOMPtr<nsIInputStream> fileStream;
|
2001-05-12 01:04:09 +04:00
|
|
|
|
|
|
|
rv = NS_NewLocalFile(data, PR_FALSE, getter_AddRefs(file));
|
2000-03-29 07:58:50 +04:00
|
|
|
if (NS_FAILED(rv)) return rv;
|
2001-05-12 01:04:09 +04:00
|
|
|
|
2001-05-14 14:20:46 +04:00
|
|
|
rv = NS_NewLocalFileInputStream(getter_AddRefs(fileStream), file);
|
|
|
|
if (NS_FAILED(rv)) return rv;
|
|
|
|
|
|
|
|
// wrap the file stream with a buffered input stream
|
|
|
|
return NS_NewBufferedInputStream(result, fileStream, 8192);
|
2000-03-29 07:58:50 +04:00
|
|
|
}
|
1999-11-01 23:48:12 +03:00
|
|
|
|
2001-05-12 01:04:09 +04:00
|
|
|
// otherwise, create a string stream for the data
|
2002-01-28 01:02:00 +03:00
|
|
|
return NS_NewCStringInputStream(result, nsDependentCString(data));
|
1999-11-01 23:48:12 +03:00
|
|
|
}
|
|
|
|
|
2000-04-13 13:20:50 +04:00
|
|
|
inline nsresult
|
|
|
|
NS_NewStreamIOChannel(nsIStreamIOChannel **result,
|
|
|
|
nsIURI* uri,
|
|
|
|
nsIStreamIO* io)
|
|
|
|
{
|
|
|
|
nsresult rv;
|
|
|
|
nsCOMPtr<nsIStreamIOChannel> channel;
|
|
|
|
static NS_DEFINE_CID(kStreamIOChannelCID, NS_STREAMIOCHANNEL_CID);
|
|
|
|
rv = nsComponentManager::CreateInstance(kStreamIOChannelCID,
|
|
|
|
nsnull,
|
|
|
|
NS_GET_IID(nsIStreamIOChannel),
|
|
|
|
getter_AddRefs(channel));
|
|
|
|
if (NS_FAILED(rv)) return rv;
|
|
|
|
rv = channel->Init(uri, io);
|
|
|
|
if (NS_FAILED(rv)) return rv;
|
|
|
|
|
|
|
|
*result = channel;
|
|
|
|
NS_ADDREF(*result);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1999-11-30 07:50:42 +03:00
|
|
|
inline nsresult
|
2000-03-29 07:58:50 +04:00
|
|
|
NS_NewInputStreamChannel(nsIChannel **result,
|
|
|
|
nsIURI* uri,
|
1999-11-30 07:50:42 +03:00
|
|
|
nsIInputStream* inStr,
|
2000-03-29 07:58:50 +04:00
|
|
|
const char* contentType,
|
|
|
|
PRInt32 contentLength)
|
1999-11-30 07:50:42 +03:00
|
|
|
{
|
|
|
|
nsresult rv;
|
2000-04-13 13:20:50 +04:00
|
|
|
nsXPIDLCString spec;
|
|
|
|
rv = uri->GetSpec(getter_Copies(spec));
|
|
|
|
if (NS_FAILED(rv)) return rv;
|
|
|
|
|
|
|
|
nsCOMPtr<nsIInputStreamIO> io;
|
|
|
|
rv = NS_NewInputStreamIO(getter_AddRefs(io), spec, inStr,
|
|
|
|
contentType, contentLength);
|
1999-11-30 07:50:42 +03:00
|
|
|
if (NS_FAILED(rv)) return rv;
|
2000-04-13 13:20:50 +04:00
|
|
|
|
|
|
|
nsCOMPtr<nsIStreamIOChannel> channel;
|
|
|
|
rv = NS_NewStreamIOChannel(getter_AddRefs(channel), uri, io);
|
1999-11-30 07:50:42 +03:00
|
|
|
if (NS_FAILED(rv)) return rv;
|
|
|
|
|
|
|
|
*result = channel;
|
|
|
|
NS_ADDREF(*result);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline nsresult
|
2001-04-10 10:01:08 +04:00
|
|
|
NS_NewLoadGroup(nsILoadGroup* *result, nsIRequestObserver* obs)
|
1999-11-30 07:50:42 +03:00
|
|
|
{
|
|
|
|
nsresult rv;
|
|
|
|
nsCOMPtr<nsILoadGroup> group;
|
|
|
|
static NS_DEFINE_CID(kLoadGroupCID, NS_LOADGROUP_CID);
|
|
|
|
rv = nsComponentManager::CreateInstance(kLoadGroupCID, nsnull,
|
|
|
|
NS_GET_IID(nsILoadGroup),
|
|
|
|
getter_AddRefs(group));
|
|
|
|
if (NS_FAILED(rv)) return rv;
|
2001-04-10 10:01:08 +04:00
|
|
|
rv = group->SetGroupObserver(obs);
|
1999-11-30 07:50:42 +03:00
|
|
|
if (NS_FAILED(rv)) return rv;
|
|
|
|
|
|
|
|
*result = group;
|
|
|
|
NS_ADDREF(*result);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-09-15 23:27:05 +04:00
|
|
|
inline nsresult
|
|
|
|
NS_NewDownloader(nsIDownloader* *result,
|
|
|
|
nsIURI* uri,
|
|
|
|
nsIDownloadObserver* observer,
|
|
|
|
nsISupports* context = nsnull,
|
2000-09-21 09:01:16 +04:00
|
|
|
PRBool synchronous = PR_FALSE,
|
2000-09-15 23:27:05 +04:00
|
|
|
nsILoadGroup* loadGroup = nsnull,
|
|
|
|
nsIInterfaceRequestor* notificationCallbacks = nsnull,
|
2001-04-10 10:01:08 +04:00
|
|
|
nsLoadFlags loadAttributes = NS_STATIC_CAST(nsLoadFlags, nsIRequest::LOAD_NORMAL))
|
2000-09-15 23:27:05 +04:00
|
|
|
{
|
|
|
|
nsresult rv;
|
|
|
|
nsCOMPtr<nsIDownloader> downloader;
|
|
|
|
static NS_DEFINE_CID(kDownloaderCID, NS_DOWNLOADER_CID);
|
|
|
|
rv = nsComponentManager::CreateInstance(kDownloaderCID,
|
|
|
|
nsnull,
|
|
|
|
NS_GET_IID(nsIDownloader),
|
|
|
|
getter_AddRefs(downloader));
|
|
|
|
if (NS_FAILED(rv)) return rv;
|
2001-02-21 23:38:08 +03:00
|
|
|
rv = downloader->Init(uri, observer, context, synchronous, loadGroup,
|
|
|
|
notificationCallbacks, loadAttributes);
|
2000-09-15 23:27:05 +04:00
|
|
|
if (NS_FAILED(rv)) return rv;
|
|
|
|
*result = downloader;
|
|
|
|
NS_ADDREF(*result);
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
1999-11-01 23:48:12 +03:00
|
|
|
inline nsresult
|
2000-02-03 02:04:47 +03:00
|
|
|
NS_NewStreamLoader(nsIStreamLoader* *result,
|
|
|
|
nsIURI* uri,
|
|
|
|
nsIStreamLoaderObserver* observer,
|
|
|
|
nsISupports* context = nsnull,
|
|
|
|
nsILoadGroup* loadGroup = nsnull,
|
|
|
|
nsIInterfaceRequestor* notificationCallbacks = nsnull,
|
2002-01-08 09:32:36 +03:00
|
|
|
nsLoadFlags loadAttributes = NS_STATIC_CAST(nsLoadFlags, nsIRequest::LOAD_NORMAL),
|
|
|
|
nsIURI* referrer = nsnull,
|
|
|
|
PRUint32 referrerFlags = 0)
|
1999-11-01 23:48:12 +03:00
|
|
|
{
|
|
|
|
nsresult rv;
|
2000-02-03 02:04:47 +03:00
|
|
|
nsCOMPtr<nsIStreamLoader> loader;
|
|
|
|
static NS_DEFINE_CID(kStreamLoaderCID, NS_STREAMLOADER_CID);
|
|
|
|
rv = nsComponentManager::CreateInstance(kStreamLoaderCID,
|
1999-11-01 23:48:12 +03:00
|
|
|
nsnull,
|
2000-02-03 02:04:47 +03:00
|
|
|
NS_GET_IID(nsIStreamLoader),
|
1999-11-01 23:48:12 +03:00
|
|
|
getter_AddRefs(loader));
|
|
|
|
if (NS_FAILED(rv)) return rv;
|
2001-02-21 23:38:08 +03:00
|
|
|
rv = loader->Init(uri, observer, context, loadGroup,
|
2002-01-08 09:32:36 +03:00
|
|
|
notificationCallbacks, loadAttributes, referrer,
|
|
|
|
referrerFlags);
|
2001-02-21 23:38:08 +03:00
|
|
|
|
1999-11-01 23:48:12 +03:00
|
|
|
if (NS_FAILED(rv)) return rv;
|
|
|
|
*result = loader;
|
|
|
|
NS_ADDREF(*result);
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
2001-01-24 01:10:34 +03:00
|
|
|
inline nsresult
|
2001-04-10 10:01:08 +04:00
|
|
|
NS_NewRequestObserverProxy(nsIRequestObserver **aResult,
|
|
|
|
nsIRequestObserver *aObserver,
|
|
|
|
nsIEventQueue *aEventQ=nsnull)
|
2001-01-24 01:10:34 +03:00
|
|
|
{
|
|
|
|
NS_ENSURE_ARG_POINTER(aResult);
|
|
|
|
|
|
|
|
nsresult rv;
|
2001-04-10 10:01:08 +04:00
|
|
|
nsCOMPtr<nsIRequestObserverProxy> proxy;
|
|
|
|
static NS_DEFINE_CID(kRequestObserverProxyCID, NS_REQUESTOBSERVERPROXY_CID);
|
2001-01-24 01:10:34 +03:00
|
|
|
|
2001-04-10 10:01:08 +04:00
|
|
|
rv = nsComponentManager::CreateInstance(kRequestObserverProxyCID,
|
2001-01-24 01:10:34 +03:00
|
|
|
nsnull,
|
2001-04-10 10:01:08 +04:00
|
|
|
NS_GET_IID(nsIRequestObserverProxy),
|
2001-01-24 01:10:34 +03:00
|
|
|
getter_AddRefs(proxy));
|
|
|
|
if (NS_FAILED(rv)) return rv;
|
|
|
|
|
|
|
|
rv = proxy->Init(aObserver, aEventQ);
|
|
|
|
if (NS_FAILED(rv)) return rv;
|
|
|
|
|
2001-03-08 10:53:40 +03:00
|
|
|
return CallQueryInterface(proxy, aResult);
|
2001-01-24 01:10:34 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
inline nsresult
|
|
|
|
NS_NewStreamListenerProxy(nsIStreamListener **aResult,
|
|
|
|
nsIStreamListener *aListener,
|
|
|
|
nsIEventQueue *aEventQ=nsnull,
|
|
|
|
PRUint32 aBufferSegmentSize=0,
|
|
|
|
PRUint32 aBufferMaxSize=0)
|
|
|
|
{
|
|
|
|
NS_ENSURE_ARG_POINTER(aResult);
|
|
|
|
|
|
|
|
nsresult rv;
|
|
|
|
nsCOMPtr<nsIStreamListenerProxy> proxy;
|
|
|
|
static NS_DEFINE_CID(kStreamListenerProxyCID, NS_STREAMLISTENERPROXY_CID);
|
|
|
|
|
|
|
|
rv = nsComponentManager::CreateInstance(kStreamListenerProxyCID,
|
|
|
|
nsnull,
|
|
|
|
NS_GET_IID(nsIStreamListenerProxy),
|
|
|
|
getter_AddRefs(proxy));
|
|
|
|
if (NS_FAILED(rv)) return rv;
|
|
|
|
|
|
|
|
rv = proxy->Init(aListener, aEventQ, aBufferSegmentSize, aBufferMaxSize);
|
|
|
|
if (NS_FAILED(rv)) return rv;
|
|
|
|
|
2001-02-21 23:38:08 +03:00
|
|
|
NS_ADDREF(*aResult = proxy);
|
2001-01-24 01:10:34 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline nsresult
|
|
|
|
NS_NewStreamProviderProxy(nsIStreamProvider **aResult,
|
|
|
|
nsIStreamProvider *aProvider,
|
|
|
|
nsIEventQueue *aEventQ=nsnull,
|
|
|
|
PRUint32 aBufferSegmentSize=0,
|
|
|
|
PRUint32 aBufferMaxSize=0)
|
|
|
|
{
|
|
|
|
NS_ENSURE_ARG_POINTER(aResult);
|
|
|
|
|
|
|
|
nsresult rv;
|
|
|
|
nsCOMPtr<nsIStreamProviderProxy> proxy;
|
|
|
|
static NS_DEFINE_CID(kStreamProviderProxyCID, NS_STREAMPROVIDERPROXY_CID);
|
|
|
|
|
|
|
|
rv = nsComponentManager::CreateInstance(kStreamProviderProxyCID,
|
|
|
|
nsnull,
|
|
|
|
NS_GET_IID(nsIStreamProviderProxy),
|
|
|
|
getter_AddRefs(proxy));
|
|
|
|
if (NS_FAILED(rv)) return rv;
|
|
|
|
|
|
|
|
rv = proxy->Init(aProvider, aEventQ, aBufferSegmentSize, aBufferMaxSize);
|
|
|
|
if (NS_FAILED(rv)) return rv;
|
|
|
|
|
2001-02-21 23:38:08 +03:00
|
|
|
NS_ADDREF(*aResult = proxy);
|
2001-01-24 01:10:34 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline nsresult
|
|
|
|
NS_NewSimpleStreamListener(nsIStreamListener **aResult,
|
|
|
|
nsIOutputStream *aSink,
|
2001-04-10 10:01:08 +04:00
|
|
|
nsIRequestObserver *aObserver=nsnull)
|
2001-01-24 01:10:34 +03:00
|
|
|
{
|
|
|
|
NS_ENSURE_ARG_POINTER(aResult);
|
|
|
|
|
|
|
|
nsresult rv;
|
|
|
|
nsCOMPtr<nsISimpleStreamListener> listener;
|
|
|
|
static NS_DEFINE_CID(kSimpleStreamListenerCID, NS_SIMPLESTREAMLISTENER_CID);
|
|
|
|
rv = nsComponentManager::CreateInstance(kSimpleStreamListenerCID,
|
|
|
|
nsnull,
|
|
|
|
NS_GET_IID(nsISimpleStreamListener),
|
|
|
|
getter_AddRefs(listener));
|
|
|
|
if (NS_FAILED(rv)) return rv;
|
|
|
|
|
|
|
|
rv = listener->Init(aSink, aObserver);
|
|
|
|
if (NS_FAILED(rv)) return rv;
|
|
|
|
|
2001-02-21 23:38:08 +03:00
|
|
|
NS_ADDREF(*aResult = listener);
|
2001-01-24 01:10:34 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline nsresult
|
|
|
|
NS_NewSimpleStreamProvider(nsIStreamProvider **aResult,
|
|
|
|
nsIInputStream *aSource,
|
2001-04-10 10:01:08 +04:00
|
|
|
nsIRequestObserver *aObserver=nsnull)
|
2001-01-24 01:10:34 +03:00
|
|
|
{
|
|
|
|
NS_ENSURE_ARG_POINTER(aResult);
|
|
|
|
|
|
|
|
nsresult rv;
|
|
|
|
nsCOMPtr<nsISimpleStreamProvider> provider;
|
|
|
|
static NS_DEFINE_CID(kSimpleStreamProviderCID, NS_SIMPLESTREAMPROVIDER_CID);
|
|
|
|
rv = nsComponentManager::CreateInstance(kSimpleStreamProviderCID,
|
|
|
|
nsnull,
|
|
|
|
NS_GET_IID(nsISimpleStreamProvider),
|
|
|
|
getter_AddRefs(provider));
|
|
|
|
if (NS_FAILED(rv)) return rv;
|
|
|
|
|
|
|
|
rv = provider->Init(aSource, aObserver);
|
|
|
|
if (NS_FAILED(rv)) return rv;
|
|
|
|
|
2001-02-21 23:38:08 +03:00
|
|
|
NS_ADDREF(*aResult = provider);
|
2001-01-24 01:10:34 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2001-04-10 10:01:08 +04:00
|
|
|
/*
|
2001-01-24 01:10:34 +03:00
|
|
|
// Depracated, prefer NS_NewStreamObserverProxy
|
1999-11-30 07:50:42 +03:00
|
|
|
inline nsresult
|
2001-04-10 10:01:08 +04:00
|
|
|
NS_NewAsyncStreamObserver(nsIRequestObserver **result,
|
|
|
|
nsIRequestObserver *receiver,
|
2000-03-29 07:58:50 +04:00
|
|
|
nsIEventQueue *eventQueue)
|
1999-11-30 07:50:42 +03:00
|
|
|
{
|
|
|
|
nsresult rv;
|
|
|
|
nsCOMPtr<nsIAsyncStreamObserver> obs;
|
|
|
|
static NS_DEFINE_CID(kAsyncStreamObserverCID, NS_ASYNCSTREAMOBSERVER_CID);
|
|
|
|
rv = nsComponentManager::CreateInstance(kAsyncStreamObserverCID,
|
|
|
|
nsnull,
|
|
|
|
NS_GET_IID(nsIAsyncStreamObserver),
|
|
|
|
getter_AddRefs(obs));
|
|
|
|
if (NS_FAILED(rv)) return rv;
|
|
|
|
rv = obs->Init(receiver, eventQueue);
|
|
|
|
if (NS_FAILED(rv)) return rv;
|
|
|
|
|
2001-02-21 23:38:08 +03:00
|
|
|
NS_ADDREF(*result = obs);
|
1999-11-30 07:50:42 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
2001-04-10 10:01:08 +04:00
|
|
|
*/
|
1999-11-30 07:50:42 +03:00
|
|
|
|
2001-01-24 01:10:34 +03:00
|
|
|
// Depracated, prefer NS_NewStreamListenerProxy
|
1999-11-30 07:50:42 +03:00
|
|
|
inline nsresult
|
2000-03-29 07:58:50 +04:00
|
|
|
NS_NewAsyncStreamListener(nsIStreamListener **result,
|
|
|
|
nsIStreamListener *receiver,
|
|
|
|
nsIEventQueue *eventQueue)
|
1999-11-30 07:50:42 +03:00
|
|
|
{
|
|
|
|
nsresult rv;
|
|
|
|
nsCOMPtr<nsIAsyncStreamListener> lsnr;
|
|
|
|
static NS_DEFINE_CID(kAsyncStreamListenerCID, NS_ASYNCSTREAMLISTENER_CID);
|
|
|
|
rv = nsComponentManager::CreateInstance(kAsyncStreamListenerCID,
|
|
|
|
nsnull,
|
|
|
|
NS_GET_IID(nsIAsyncStreamListener),
|
|
|
|
getter_AddRefs(lsnr));
|
|
|
|
if (NS_FAILED(rv)) return rv;
|
|
|
|
rv = lsnr->Init(receiver, eventQueue);
|
|
|
|
if (NS_FAILED(rv)) return rv;
|
|
|
|
|
2001-02-21 23:38:08 +03:00
|
|
|
NS_ADDREF(*result = lsnr);
|
1999-11-30 07:50:42 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2001-01-24 01:10:34 +03:00
|
|
|
// Depracated, prefer a true synchonous implementation
|
1999-11-30 07:50:42 +03:00
|
|
|
inline nsresult
|
2001-01-24 01:10:34 +03:00
|
|
|
NS_NewSyncStreamListener(nsIInputStream **aInStream,
|
|
|
|
nsIOutputStream **aOutStream,
|
|
|
|
nsIStreamListener **aResult)
|
1999-11-30 07:50:42 +03:00
|
|
|
{
|
|
|
|
nsresult rv;
|
2001-01-24 01:10:34 +03:00
|
|
|
|
|
|
|
NS_ENSURE_ARG_POINTER(aInStream);
|
|
|
|
NS_ENSURE_ARG_POINTER(aOutStream);
|
|
|
|
|
|
|
|
nsCOMPtr<nsIInputStream> pipeIn;
|
|
|
|
nsCOMPtr<nsIOutputStream> pipeOut;
|
|
|
|
|
|
|
|
rv = NS_NewPipe(getter_AddRefs(pipeIn),
|
|
|
|
getter_AddRefs(pipeOut),
|
|
|
|
4*1024, // NS_SYNC_STREAM_LISTENER_SEGMENT_SIZE
|
|
|
|
32*1024); // NS_SYNC_STREAM_LISTENER_BUFFER_SIZE
|
1999-11-30 07:50:42 +03:00
|
|
|
if (NS_FAILED(rv)) return rv;
|
2001-01-24 01:10:34 +03:00
|
|
|
|
|
|
|
rv = NS_NewSimpleStreamListener(aResult, pipeOut);
|
1999-11-30 07:50:42 +03:00
|
|
|
if (NS_FAILED(rv)) return rv;
|
|
|
|
|
2001-02-21 23:38:08 +03:00
|
|
|
NS_ADDREF(*aInStream = pipeIn);
|
|
|
|
NS_ADDREF(*aOutStream = pipeOut);
|
1999-11-30 07:50:42 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2001-01-24 01:10:34 +03:00
|
|
|
//
|
2001-02-21 23:38:08 +03:00
|
|
|
// Calls AsyncWrite on the specified transport, with a stream provider that
|
2001-01-24 01:10:34 +03:00
|
|
|
// reads data from the specified input stream.
|
|
|
|
//
|
|
|
|
inline nsresult
|
2001-02-21 23:38:08 +03:00
|
|
|
NS_AsyncWriteFromStream(nsIRequest **aRequest,
|
|
|
|
nsITransport *aTransport,
|
2001-01-24 01:10:34 +03:00
|
|
|
nsIInputStream *aSource,
|
2001-02-21 23:38:08 +03:00
|
|
|
PRUint32 aOffset=0,
|
|
|
|
PRUint32 aCount=0,
|
|
|
|
PRUint32 aFlags=0,
|
2001-04-10 10:01:08 +04:00
|
|
|
nsIRequestObserver *aObserver=NULL,
|
2001-01-24 01:10:34 +03:00
|
|
|
nsISupports *aContext=NULL)
|
|
|
|
{
|
2001-02-21 23:38:08 +03:00
|
|
|
NS_ENSURE_ARG_POINTER(aTransport);
|
2001-01-24 01:10:34 +03:00
|
|
|
|
|
|
|
nsresult rv;
|
|
|
|
nsCOMPtr<nsIStreamProvider> provider;
|
|
|
|
rv = NS_NewSimpleStreamProvider(getter_AddRefs(provider),
|
|
|
|
aSource,
|
|
|
|
aObserver);
|
|
|
|
if (NS_FAILED(rv)) return rv;
|
|
|
|
|
2001-03-08 10:53:40 +03:00
|
|
|
//
|
|
|
|
// We can safely allow the transport impl to bypass proxying the provider
|
|
|
|
// since we are using a simple stream provider.
|
|
|
|
//
|
|
|
|
// A simple stream provider masks the OnDataWritable from consumers.
|
|
|
|
// Moreover, it makes an assumption about the underlying nsIInputStream
|
|
|
|
// implementation: namely, that it is thread-safe and blocking.
|
|
|
|
//
|
|
|
|
// So, let's always make this optimization.
|
|
|
|
//
|
2001-05-12 01:04:09 +04:00
|
|
|
aFlags |= nsITransport::DONT_PROXY_PROVIDER;
|
2001-03-08 10:53:40 +03:00
|
|
|
|
2001-02-21 23:38:08 +03:00
|
|
|
return aTransport->AsyncWrite(provider, aContext,
|
|
|
|
aOffset,
|
|
|
|
aCount,
|
|
|
|
aFlags,
|
2001-05-03 14:09:59 +04:00
|
|
|
aRequest);
|
2001-01-24 01:10:34 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
//
|
2001-02-21 23:38:08 +03:00
|
|
|
// Calls AsyncRead on the specified transport, with a stream listener that
|
2001-01-24 01:10:34 +03:00
|
|
|
// writes data to the specified output stream.
|
|
|
|
//
|
|
|
|
inline nsresult
|
2001-02-21 23:38:08 +03:00
|
|
|
NS_AsyncReadToStream(nsIRequest **aRequest,
|
|
|
|
nsITransport *aTransport,
|
2001-01-24 01:10:34 +03:00
|
|
|
nsIOutputStream *aSink,
|
2001-02-21 23:38:08 +03:00
|
|
|
PRUint32 aOffset=0,
|
|
|
|
PRUint32 aCount=0,
|
|
|
|
PRUint32 aFlags=0,
|
2001-04-10 10:01:08 +04:00
|
|
|
nsIRequestObserver *aObserver=NULL,
|
2001-01-24 01:10:34 +03:00
|
|
|
nsISupports *aContext=NULL)
|
|
|
|
{
|
2001-02-21 23:38:08 +03:00
|
|
|
NS_ENSURE_ARG_POINTER(aTransport);
|
2001-01-24 01:10:34 +03:00
|
|
|
|
|
|
|
nsresult rv;
|
|
|
|
nsCOMPtr<nsIStreamListener> listener;
|
|
|
|
rv = NS_NewSimpleStreamListener(getter_AddRefs(listener),
|
|
|
|
aSink,
|
|
|
|
aObserver);
|
|
|
|
if (NS_FAILED(rv)) return rv;
|
|
|
|
|
2001-02-21 23:38:08 +03:00
|
|
|
return aTransport->AsyncRead(listener, aContext,
|
|
|
|
aOffset,
|
|
|
|
aCount,
|
|
|
|
aFlags,
|
2001-05-03 14:09:59 +04:00
|
|
|
aRequest);
|
2001-01-24 01:10:34 +03:00
|
|
|
}
|
|
|
|
|
2001-06-06 04:10:09 +04:00
|
|
|
inline nsresult
|
2001-07-19 03:48:21 +04:00
|
|
|
NS_CheckPortSafety(PRInt32 port, const char* scheme, nsIIOService* ioService = nsnull)
|
2001-06-06 04:10:09 +04:00
|
|
|
{
|
|
|
|
nsresult rv;
|
|
|
|
|
|
|
|
nsCOMPtr<nsIIOService> serv;
|
|
|
|
if (ioService == nsnull) {
|
|
|
|
serv = do_GetIOService(&rv);
|
|
|
|
if (NS_FAILED(rv)) return rv;
|
|
|
|
ioService = serv.get();
|
|
|
|
}
|
|
|
|
|
|
|
|
PRBool allow;
|
|
|
|
|
|
|
|
rv = ioService->AllowPort(port, scheme, &allow);
|
|
|
|
if (NS_FAILED(rv)) {
|
|
|
|
NS_ERROR("NS_CheckPortSafety: ioService->AllowPort failed\n");
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!allow)
|
|
|
|
return NS_ERROR_PORT_ACCESS_NOT_ALLOWED;
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2001-09-13 06:21:05 +04:00
|
|
|
inline nsresult
|
|
|
|
NS_NewProxyInfo(const char* type, const char* host, PRInt32 port, nsIProxyInfo* *result)
|
|
|
|
{
|
|
|
|
nsresult rv;
|
|
|
|
|
|
|
|
static NS_DEFINE_CID(kPPSServiceCID, NS_PROTOCOLPROXYSERVICE_CID);
|
|
|
|
nsCOMPtr<nsIProtocolProxyService> pps = do_GetService(kPPSServiceCID,&rv);
|
|
|
|
|
|
|
|
if (NS_FAILED(rv)) return rv;
|
|
|
|
|
|
|
|
return pps->NewProxyInfo(type, host, port, result);
|
|
|
|
}
|
|
|
|
|
2001-12-19 03:55:42 +03:00
|
|
|
inline nsresult
|
|
|
|
NS_InitFileFromURLSpec(nsIFile* aFile, const char *inURL,
|
|
|
|
nsIIOService *ioService=nsnull)
|
|
|
|
{
|
|
|
|
nsCOMPtr<nsIIOService> serv;
|
|
|
|
if (ioService == nsnull) {
|
|
|
|
nsresult rv;
|
|
|
|
serv = do_GetIOService(&rv);
|
|
|
|
if (NS_FAILED(rv)) return rv;
|
|
|
|
ioService = serv.get();
|
|
|
|
}
|
|
|
|
return ioService->InitFileFromURLSpec(aFile, inURL);
|
|
|
|
}
|
|
|
|
|
|
|
|
inline nsresult
|
|
|
|
NS_GetURLSpecFromFile(nsIFile* aFile, char **aUrl,
|
|
|
|
nsIIOService *ioService=nsnull)
|
|
|
|
{
|
|
|
|
nsCOMPtr<nsIIOService> serv;
|
|
|
|
if (ioService == nsnull) {
|
|
|
|
nsresult rv;
|
|
|
|
serv = do_GetIOService(&rv);
|
|
|
|
if (NS_FAILED(rv)) return rv;
|
|
|
|
ioService = serv.get();
|
|
|
|
}
|
|
|
|
return ioService->GetURLSpecFromFile(aFile, aUrl);
|
|
|
|
}
|
|
|
|
|
1999-11-01 23:48:12 +03:00
|
|
|
#endif // nsNetUtil_h__
|