зеркало из https://github.com/mozilla/gecko-dev.git
Adding GetSecurityInfo to the nsIChannel. bug 29646. r=warren.
This commit is contained in:
Родитель
78f623abb8
Коммит
8126ff53b4
|
@ -343,6 +343,12 @@ nsCachedChromeChannel::SetNotificationCallbacks(nsIInterfaceRequestor * aNotific
|
|||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCachedChromeChannel::GetSecurityInfo(nsISupports * *aSecurityInfo)
|
||||
{
|
||||
*aSecurityInfo = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsCachedChromeChannel::PostLoadEvent(nsCachedChromeChannel* aChannel,
|
||||
|
|
|
@ -303,6 +303,12 @@ nsDateTimeChannel::SetNotificationCallbacks(nsIInterfaceRequestor* aNotification
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDateTimeChannel::GetSecurityInfo(nsISupports * *aSecurityInfo)
|
||||
{
|
||||
*aSecurityInfo = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// nsIStreamObserver methods
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -341,6 +341,12 @@ nsFingerChannel::SetNotificationCallbacks(nsIInterfaceRequestor* aNotificationCa
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFingerChannel::GetSecurityInfo(nsISupports * *aSecurityInfo)
|
||||
{
|
||||
*aSecurityInfo = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// nsIStreamObserver methods
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -71,9 +71,8 @@ nsSSLSocketProvider::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSSLSocketProvider::NewSocket(const char *hostName, PRFileDesc **_result)
|
||||
nsSSLSocketProvider::NewSocket(const char *hostName, PRFileDesc **_result, nsISupports **securityInfo)
|
||||
{
|
||||
*_result = nsSSLIOLayerNewSocket(hostName);
|
||||
|
||||
return (nsnull == *_result) ? NS_ERROR_SOCKET_CREATE_FAILED : NS_OK;
|
||||
nsresult rv = nsSSLIOLayerNewSocket(hostName, _result, securityInfo);
|
||||
return (NS_FAILED(rv)) ? NS_ERROR_SOCKET_CREATE_FAILED : NS_OK;
|
||||
}
|
||||
|
|
|
@ -437,6 +437,14 @@ nsMsgProtocol::SetNotificationCallbacks(nsIInterfaceRequestor* aNotificationCall
|
|||
return NS_OK; // don't fail when trying to set this
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgProtocol::GetSecurityInfo(nsISupports * *aSecurityInfo)
|
||||
{
|
||||
*aSecurityInfo = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// From nsIRequest
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -284,6 +284,12 @@ NS_IMETHODIMP nsMailtoChannel::SetNotificationCallbacks(nsIInterfaceRequestor* a
|
|||
return NS_OK; // don't fail when trying to set this
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMailtoChannel::GetSecurityInfo(nsISupports * *aSecurityInfo)
|
||||
{
|
||||
*aSecurityInfo = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMailtoChannel::GetOriginalURI(nsIURI * *aURI)
|
||||
{
|
||||
|
|
|
@ -6622,3 +6622,10 @@ nsImapMockChannel::SetNotificationCallbacks(nsIInterfaceRequestor* aNotification
|
|||
{
|
||||
return NS_OK; // don't fail when trying to set this
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImapMockChannel::GetSecurityInfo(nsISupports * *aSecurityInfo)
|
||||
{
|
||||
*aSecurityInfo = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -586,6 +586,12 @@ nsJARChannel::SetNotificationCallbacks(nsIInterfaceRequestor* aNotificationCallb
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::GetSecurityInfo(nsISupports * *aSecurityInfo)
|
||||
{
|
||||
*aSecurityInfo = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsIStreamObserver methods:
|
||||
|
||||
|
|
|
@ -211,6 +211,12 @@ interface nsIChannel : nsIRequest
|
|||
*/
|
||||
attribute nsIInterfaceRequestor notificationCallbacks;
|
||||
|
||||
/**
|
||||
* Any security information about this channel. This can be null.
|
||||
*/
|
||||
|
||||
readonly attribute nsISupports securityInfo;
|
||||
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -1279,4 +1279,11 @@ nsFileTransport::SetNotificationCallbacks(nsIInterfaceRequestor* aNotificationCa
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFileTransport::GetSecurityInfo(nsISupports * *aSecurityInfo)
|
||||
{
|
||||
*aSecurityInfo = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -338,6 +338,14 @@ nsInputStreamChannel::SetNotificationCallbacks(nsIInterfaceRequestor* aNotificat
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInputStreamChannel::GetSecurityInfo(nsISupports * *aSecurityInfo)
|
||||
{
|
||||
*aSecurityInfo = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsIStreamListener methods:
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -735,12 +735,12 @@ nsresult nsSocketTransport::doConnection(PRInt16 aSelectFlags)
|
|||
// Step 1:
|
||||
// Create a new TCP socket structure...
|
||||
//
|
||||
if (!mSocketType)
|
||||
{
|
||||
if (!mSocketType)
|
||||
{
|
||||
mSocketFD = PR_NewTCPSocket();
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
NS_WITH_SERVICE(nsISocketProviderService,
|
||||
pProviderService,
|
||||
kSocketProviderService,
|
||||
|
@ -752,8 +752,8 @@ nsresult nsSocketTransport::doConnection(PRInt16 aSelectFlags)
|
|||
rv = pProviderService->GetSocketProvider(mSocketType, getter_AddRefs(pProvider));
|
||||
|
||||
if (NS_SUCCEEDED(rv))
|
||||
rv = pProvider->NewSocket(mHostName, &mSocketFD);
|
||||
}
|
||||
rv = pProvider->NewSocket(mHostName, &mSocketFD, getter_AddRefs(mSecurityInfo));
|
||||
}
|
||||
|
||||
if (mSocketFD) {
|
||||
PRSocketOptionData opt;
|
||||
|
@ -1330,6 +1330,14 @@ nsSocketTransport::SetBytesExpected (PRInt32 bytes)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSocketTransport::GetSecurityInfo(nsISupports **info)
|
||||
{
|
||||
*info = mSecurityInfo.get();
|
||||
NS_IF_ADDREF(*info);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// --------------------------------------------------------------------------
|
||||
|
|
|
@ -209,6 +209,7 @@ protected:
|
|||
nsCOMPtr<nsIStreamObserver> mOpenObserver;
|
||||
nsSocketOperation mOperation;
|
||||
nsCOMPtr<nsISupports> mOwner;
|
||||
nsCOMPtr<nsISupports> mSecurityInfo;
|
||||
PRInt32 mPort;
|
||||
char* mPrintHost; // not the proxy
|
||||
nsCOMPtr<nsISupports> mReadContext;
|
||||
|
|
|
@ -520,6 +520,13 @@ nsDiskCacheRecordChannel::SetNotificationCallbacks(nsIInterfaceRequestor* aNotif
|
|||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDiskCacheRecordChannel::GetSecurityInfo(nsISupports * *aSecurityInfo)
|
||||
{
|
||||
*aSecurityInfo = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsIStreamListener methods:
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -535,3 +535,10 @@ nsMemCacheChannel::SetNotificationCallbacks(nsIInterfaceRequestor* aNotification
|
|||
NS_ASSERTION(0, "nsMemCacheChannel method unexpectedly called");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMemCacheChannel::GetSecurityInfo(nsISupports * *aSecurityInfo)
|
||||
{
|
||||
*aSecurityInfo = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -431,3 +431,9 @@ nsDataChannel::SetNotificationCallbacks(nsIInterfaceRequestor* aNotificationCall
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDataChannel::GetSecurityInfo(nsISupports * *aSecurityInfo)
|
||||
{
|
||||
*aSecurityInfo = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -303,6 +303,12 @@ nsDateTimeChannel::SetNotificationCallbacks(nsIInterfaceRequestor* aNotification
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDateTimeChannel::GetSecurityInfo(nsISupports * *aSecurityInfo)
|
||||
{
|
||||
*aSecurityInfo = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// nsIStreamObserver methods
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -426,6 +426,12 @@ nsFileChannel::SetNotificationCallbacks(nsIInterfaceRequestor* aNotificationCall
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFileChannel::GetSecurityInfo(nsISupports * *aSecurityInfo)
|
||||
{
|
||||
*aSecurityInfo = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsIStreamListener methods:
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -341,6 +341,12 @@ nsFingerChannel::SetNotificationCallbacks(nsIInterfaceRequestor* aNotificationCa
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFingerChannel::GetSecurityInfo(nsISupports * *aSecurityInfo)
|
||||
{
|
||||
*aSecurityInfo = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// nsIStreamObserver methods
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -501,6 +501,13 @@ nsFTPChannel::SetNotificationCallbacks(nsIInterfaceRequestor* aNotificationCallb
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFTPChannel::GetSecurityInfo(nsISupports * *aSecurityInfo)
|
||||
{
|
||||
*aSecurityInfo = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFTPChannel::SetContentLength(PRInt32 aLength) {
|
||||
nsAutoLock lock(mLock);
|
||||
|
|
|
@ -98,6 +98,7 @@ interface nsIHTTPChannel : nsIChannel
|
|||
to allow other non-http specs to be used in proxy cases.
|
||||
*/
|
||||
attribute string ProxyRequestURI;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
#include "nsIProxy.h"
|
||||
#include "nsMimeTypes.h"
|
||||
#include "nsIPrompt.h"
|
||||
|
||||
#include "nsISocketTransport.h"
|
||||
// FIXME - Temporary include. Delete this when cache is enabled on all platforms
|
||||
#include "nsIPref.h"
|
||||
|
||||
|
@ -105,7 +105,8 @@ nsHTTPChannel::nsHTTPChannel(nsIURI* i_URL,
|
|||
mProxy(0),
|
||||
mProxyPort(-1),
|
||||
mBufferSegmentSize(bufferSegmentSize),
|
||||
mBufferMaxSize(bufferMaxSize)
|
||||
mBufferMaxSize(bufferMaxSize),
|
||||
mTransport(nsnull)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
|
||||
|
@ -1091,7 +1092,6 @@ nsHTTPChannel::Open(void)
|
|||
// Set up a new request observer and a response listener and pass
|
||||
// to the transport
|
||||
nsresult rv = NS_OK;
|
||||
nsCOMPtr<nsIChannel> transport;
|
||||
|
||||
// If this is the first time, then add the channel to its load group
|
||||
if (mState == HS_IDLE) {
|
||||
|
@ -1128,7 +1128,7 @@ nsHTTPChannel::Open(void)
|
|||
|
||||
rv = mHandler->RequestTransport(mURI, this,
|
||||
mBufferSegmentSize, mBufferMaxSize,
|
||||
getter_AddRefs(transport));
|
||||
getter_AddRefs(mTransport));
|
||||
|
||||
if (NS_ERROR_BUSY == rv) {
|
||||
mState = HS_WAITING_FOR_OPEN;
|
||||
|
@ -1139,13 +1139,13 @@ nsHTTPChannel::Open(void)
|
|||
(void) ResponseCompleted(mResponseDataListener, rv, nsnull);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
// pass ourself in to act as a proxy for progress callbacks
|
||||
rv = transport->SetNotificationCallbacks(this);
|
||||
rv = mTransport->SetNotificationCallbacks(this);
|
||||
if (NS_FAILED(rv)) {
|
||||
// Unable to create a transport... End the request...
|
||||
(void) ResponseCompleted(mResponseDataListener, rv, nsnull);
|
||||
(void) ReleaseTransport(transport);
|
||||
(void) ReleaseTransport(mTransport);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -1183,7 +1183,7 @@ nsHTTPChannel::Open(void)
|
|||
rv = pModules->GetNext(getter_AddRefs(supEntry)); // go around again
|
||||
}
|
||||
|
||||
mRequest->SetTransport(transport);
|
||||
mRequest->SetTransport(mTransport);
|
||||
|
||||
// if using proxy...
|
||||
nsXPIDLCString requestSpec;
|
||||
|
@ -1997,3 +1997,18 @@ nsHTTPChannel::GetUsingProxy(PRBool *aUsingProxy)
|
|||
*aUsingProxy = (mProxy && *mProxy);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTTPChannel::GetSecurityInfo(nsISupports * *aSecurityInfo)
|
||||
{
|
||||
*aSecurityInfo = nsnull;
|
||||
|
||||
if (!aSecurityInfo)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
if (!mTransport)
|
||||
return NS_OK;
|
||||
|
||||
return mTransport->GetSecurityInfo(aSecurityInfo);
|
||||
}
|
||||
|
|
|
@ -148,7 +148,9 @@ protected:
|
|||
nsCOMPtr<nsILoadGroup> mLoadGroup;
|
||||
|
||||
nsCOMPtr<nsISupports> mOwner;
|
||||
|
||||
|
||||
nsCOMPtr<nsIChannel> mTransport;
|
||||
|
||||
// Cache-related members
|
||||
nsCOMPtr<nsICachedNetData> mCacheEntry;
|
||||
nsHTTPResponse* mCachedResponse;
|
||||
|
|
|
@ -586,6 +586,12 @@ nsJARChannel::SetNotificationCallbacks(nsIInterfaceRequestor* aNotificationCallb
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::GetSecurityInfo(nsISupports * *aSecurityInfo)
|
||||
{
|
||||
*aSecurityInfo = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsIStreamObserver methods:
|
||||
|
||||
|
|
|
@ -562,6 +562,13 @@ nsResChannel::SetNotificationCallbacks(nsIInterfaceRequestor* aNotificationCallb
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsResChannel::GetSecurityInfo(nsISupports * *aSecurityInfo)
|
||||
{
|
||||
*aSecurityInfo = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsIStreamListener methods:
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
[noscript, uuid(0906de00-5414-11d3-bbc8-0000861d1237)]
|
||||
interface nsISocketProvider : nsISupports {
|
||||
|
||||
nsFileDescStar NewSocket ( in string hostName );
|
||||
void NewSocket ( in string hostName, out nsFileDescStar fileDesc, out nsISupports securityInfo );
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -343,6 +343,12 @@ nsCachedChromeChannel::SetNotificationCallbacks(nsIInterfaceRequestor * aNotific
|
|||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCachedChromeChannel::GetSecurityInfo(nsISupports * *aSecurityInfo)
|
||||
{
|
||||
*aSecurityInfo = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsCachedChromeChannel::PostLoadEvent(nsCachedChromeChannel* aChannel,
|
||||
|
|
Загрузка…
Ссылка в новой задаче