зеркало из https://github.com/mozilla/pjs.git
Fixed tabs to spaces and misc leaks...
This commit is contained in:
Родитель
319f0b5a91
Коммит
57a7e15a93
|
@ -258,7 +258,7 @@ nsIOService::MakeAbsolute(const char *aSpec,
|
|||
|
||||
if (aSpec == nsnull)
|
||||
return aBaseURI->GetSpec(result);
|
||||
|
||||
|
||||
char* scheme;
|
||||
rv = GetScheme(aSpec, &scheme);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
|
|
|
@ -87,7 +87,7 @@ NS_METHOD
|
|||
nsLoadGroup::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
NS_ENSURE_PROPER_AGGREGATION(aOuter, aIID);
|
||||
NS_ENSURE_PROPER_AGGREGATION(aOuter, aIID);
|
||||
|
||||
nsLoadGroup* group = new nsLoadGroup(aOuter);
|
||||
if (group == nsnull)
|
||||
|
@ -95,8 +95,8 @@ nsLoadGroup::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
|
|||
|
||||
nsresult rv = group->AggregatedQueryInterface(aIID, aResult);
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
delete group;
|
||||
if (NS_FAILED(rv))
|
||||
delete group;
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
@ -134,19 +134,19 @@ nsLoadGroup::AggregatedQueryInterface(const nsIID& aIID, void** aInstancePtr)
|
|||
{
|
||||
NS_ENSURE_ARG_POINTER(aInstancePtr);
|
||||
|
||||
if (aIID.Equals(NS_GET_IID(nsISupports)))
|
||||
*aInstancePtr = GetInner();
|
||||
if (aIID.Equals(NS_GET_IID(nsISupports)))
|
||||
*aInstancePtr = GetInner();
|
||||
else if (aIID.Equals(kLoadGroupCID) || // for internal use only (to set parent)
|
||||
aIID.Equals(nsCOMTypeInfo<nsILoadGroup>::GetIID()) ||
|
||||
aIID.Equals(nsCOMTypeInfo<nsIRequest>::GetIID()) ||
|
||||
aIID.Equals(nsCOMTypeInfo<nsISupports>::GetIID()))
|
||||
*aInstancePtr = NS_STATIC_CAST(nsILoadGroup*, this);
|
||||
else {
|
||||
else {
|
||||
*aInstancePtr = nsnull;
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
NS_ADDREF((nsISupports*)*aInstancePtr);
|
||||
NS_ADDREF((nsISupports*)*aInstancePtr);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -451,7 +451,7 @@ nsLoadGroup::AddChannel(nsIChannel *channel, nsISupports* ctxt)
|
|||
nsCRT::free(uriStr);
|
||||
#endif
|
||||
|
||||
rv = mChannels->AppendElement(channel) ? NS_OK : NS_ERROR_FAILURE; // XXX this method incorrectly returns a bool
|
||||
rv = mChannels->AppendElement(channel) ? NS_OK : NS_ERROR_FAILURE; // XXX this method incorrectly returns a bool
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsLoadFlags flags;
|
||||
|
@ -521,7 +521,7 @@ nsLoadGroup::RemoveChannel(nsIChannel *channel, nsISupports* ctxt,
|
|||
// the channel was *not* in the group so do not update the foreground
|
||||
// count or it will get messed up...
|
||||
//
|
||||
rv = mChannels->RemoveElement(channel) ? NS_OK : NS_ERROR_FAILURE; // XXX this method incorrectly returns a bool
|
||||
rv = mChannels->RemoveElement(channel) ? NS_OK : NS_ERROR_FAILURE; // XXX this method incorrectly returns a bool
|
||||
if (NS_FAILED(rv)) {
|
||||
PR_LOG(gLoadGroupLog, PR_LOG_ERROR,
|
||||
("LOADGROUP: %x Unable to remove channel %x. Not in group!\n",
|
||||
|
@ -533,7 +533,7 @@ nsLoadGroup::RemoveChannel(nsIChannel *channel, nsISupports* ctxt,
|
|||
rv = channel->GetLoadAttributes(&flags);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
if (!(flags & nsIChannel::LOAD_BACKGROUND)) {
|
||||
NS_ASSERTION(mForegroundCount > 0, "mForegroundCount messed up");
|
||||
NS_ASSERTION(mForegroundCount > 0, "mForegroundCount messed up");
|
||||
--mForegroundCount;
|
||||
|
||||
PRBool pending;
|
||||
|
@ -600,7 +600,7 @@ nsLoadGroup::AddSubGroup(nsILoadGroup *group)
|
|||
|
||||
PR_LOG(gLoadGroupLog, PR_LOG_DEBUG,
|
||||
("LOADGROUP: %x Adding sub-group %x.\n", this, group));
|
||||
return mSubGroups->AppendElement(group) ? NS_OK : NS_ERROR_FAILURE; // XXX this method incorrectly returns a bool
|
||||
return mSubGroups->AppendElement(group) ? NS_OK : NS_ERROR_FAILURE; // XXX this method incorrectly returns a bool
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -619,7 +619,7 @@ nsLoadGroup::RemoveSubGroup(nsILoadGroup *group)
|
|||
|
||||
PR_LOG(gLoadGroupLog, PR_LOG_DEBUG,
|
||||
("LOADGROUP: %x Removing sub-group %x.\n", this, group));
|
||||
return mSubGroups->RemoveElement(group) ? NS_OK : NS_ERROR_FAILURE; // XXX this method incorrectly returns a bool
|
||||
return mSubGroups->RemoveElement(group) ? NS_OK : NS_ERROR_FAILURE; // XXX this method incorrectly returns a bool
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -57,10 +57,10 @@ NS_IMETHODIMP
|
|||
nsNetModRegEntry::GetTopic(char **topic)
|
||||
{
|
||||
if (mTopic)
|
||||
{
|
||||
*topic = (char *) nsAllocator::Clone(mTopic, nsCRT::strlen(mTopic) + 1);
|
||||
return NS_OK;
|
||||
}
|
||||
{
|
||||
*topic = (char *) nsAllocator::Clone(mTopic, nsCRT::strlen(mTopic) + 1);
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
|
@ -80,8 +80,8 @@ nsNetModRegEntry::Equals(nsINetModRegEntry* aEntry, PRBool *_retVal)
|
|||
|
||||
if (topic) {
|
||||
nsAllocator::Free(topic);
|
||||
topic=0;
|
||||
}
|
||||
topic=0;
|
||||
}
|
||||
|
||||
if (topic && PL_strcmp(topic, mTopic))
|
||||
return NS_OK;
|
||||
|
|
|
@ -52,15 +52,15 @@ nsSimpleURI::AggregatedQueryInterface(const nsIID& aIID, void** aInstancePtr)
|
|||
{
|
||||
NS_ENSURE_ARG_POINTER(aInstancePtr);
|
||||
|
||||
if (aIID.Equals(kISupportsIID))
|
||||
*aInstancePtr = GetInner();
|
||||
if (aIID.Equals(kISupportsIID))
|
||||
*aInstancePtr = GetInner();
|
||||
else if (aIID.Equals(kThisSimpleURIImplementationCID) || // used by Equals
|
||||
aIID.Equals(nsIURI::GetIID()))
|
||||
*aInstancePtr = NS_STATIC_CAST(nsIURI*, this);
|
||||
else {
|
||||
*aInstancePtr = nsnull;
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
else {
|
||||
*aInstancePtr = nsnull;
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
NS_ADDREF((nsISupports*)*aInstancePtr);
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -98,12 +98,12 @@ nsSimpleURI::SetSpec(char* aSpec)
|
|||
n = spec.Mid(path, pos + 1, count);
|
||||
NS_ASSERTION(n == count, "Mid failed");
|
||||
if (mScheme)
|
||||
nsCRT::free(mScheme);
|
||||
nsCRT::free(mScheme);
|
||||
mScheme = scheme.ToNewCString();
|
||||
if (mScheme == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
if (mPath)
|
||||
nsCRT::free(mPath);
|
||||
nsCRT::free(mPath);
|
||||
mPath = path.ToNewCString();
|
||||
if (mPath == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
@ -222,7 +222,7 @@ NS_METHOD
|
|||
nsSimpleURI::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
NS_ENSURE_PROPER_AGGREGATION(aOuter, aIID);
|
||||
NS_ENSURE_PROPER_AGGREGATION(aOuter, aIID);
|
||||
|
||||
nsSimpleURI* url = new nsSimpleURI(aOuter);
|
||||
if (url == nsnull)
|
||||
|
@ -230,8 +230,8 @@ nsSimpleURI::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
|
|||
|
||||
nsresult rv = url->AggregatedQueryInterface(aIID, aResult);
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
delete url;
|
||||
if (NS_FAILED(rv))
|
||||
delete url;
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
|
@ -148,7 +148,7 @@ nsSocketTransport::nsSocketTransport()
|
|||
// Set up Internet defaults...
|
||||
//
|
||||
memset(&mNetAddress, 0, sizeof(mNetAddress));
|
||||
PR_InitializeNetAddr(PR_IpAddrNull, 0, &mNetAddress);
|
||||
PR_InitializeNetAddr(PR_IpAddrNull, 0, &mNetAddress);
|
||||
|
||||
//
|
||||
// Initialize the global connect timeout value if necessary...
|
||||
|
@ -538,7 +538,7 @@ nsresult nsSocketTransport::doResolveHost(void)
|
|||
rv = NS_ERROR_UNKNOWN_HOST; // check this!
|
||||
}
|
||||
status = PR_GetHostByAddr(netAddr, dbbuf, sizeof(dbbuf), &hostEnt);
|
||||
nsAllocator::Free(netAddr);
|
||||
nsAllocator::Free(netAddr);
|
||||
} else {
|
||||
status = PR_GetHostByName(mHostName, dbbuf, sizeof(dbbuf), &hostEnt);
|
||||
}
|
||||
|
@ -1643,10 +1643,10 @@ nsSocketTransport::OpenOutputStream(PRUint32 startPosition, nsIOutputStream* *re
|
|||
mWriteObserver = null_nsCOMPtr();
|
||||
mWriteContext = null_nsCOMPtr();
|
||||
|
||||
// We want a pipe here so the caller can "write" into one end
|
||||
// and the other end (aWriteStream) gets the data. This data
|
||||
// is then written to the underlying socket when nsSocketTransport::doWrite()
|
||||
// is called.
|
||||
// We want a pipe here so the caller can "write" into one end
|
||||
// and the other end (aWriteStream) gets the data. This data
|
||||
// is then written to the underlying socket when nsSocketTransport::doWrite()
|
||||
// is called.
|
||||
|
||||
nsCOMPtr<nsIBufferOutputStream> out;
|
||||
nsCOMPtr<nsIBufferInputStream> in;
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -39,11 +39,11 @@ public:
|
|||
// nsStdURL methods:
|
||||
|
||||
nsStdURL(const char* i_Spec, nsISupports* outer=nsnull);
|
||||
nsStdURL(const nsStdURL& i_URL);
|
||||
nsStdURL(const nsStdURL& i_URL);
|
||||
virtual ~nsStdURL();
|
||||
|
||||
nsStdURL& operator =(const nsStdURL& otherURL);
|
||||
PRBool operator ==(const nsStdURL& otherURL) const;
|
||||
nsStdURL& operator =(const nsStdURL& otherURL);
|
||||
PRBool operator ==(const nsStdURL& otherURL) const;
|
||||
|
||||
static NS_METHOD
|
||||
Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
|
||||
|
@ -58,8 +58,8 @@ public:
|
|||
// nsIURL methods:
|
||||
NS_DECL_NSIURL
|
||||
|
||||
/* todo move this to protected later */
|
||||
nsresult ParsePath(void);
|
||||
/* todo move this to protected later */
|
||||
nsresult ParsePath(void);
|
||||
|
||||
protected:
|
||||
nsresult Parse(void);
|
||||
|
@ -67,8 +67,8 @@ protected:
|
|||
nsresult ReconstructSpec(void);
|
||||
|
||||
// Some handy functions
|
||||
nsresult DupString(char* *o_Destination, char* i_Source);
|
||||
nsresult ExtractString(char* i_Source, char* *o_Destination, PRUint32 start, PRUint32 length);
|
||||
nsresult DupString(char* *o_Destination, char* i_Source);
|
||||
nsresult ExtractString(char* i_Source, char* *o_Destination, PRUint32 start, PRUint32 length);
|
||||
protected:
|
||||
|
||||
char* mScheme;
|
||||
|
@ -77,10 +77,10 @@ protected:
|
|||
PRInt32 mPort;
|
||||
char* mPath;
|
||||
|
||||
char* mDirectory;
|
||||
char* mFileName;
|
||||
char* mParam;
|
||||
char* mQuery;
|
||||
char* mDirectory;
|
||||
char* mFileName;
|
||||
char* mParam;
|
||||
char* mQuery;
|
||||
char* mRef;
|
||||
|
||||
char* mSpec;
|
||||
|
@ -90,107 +90,107 @@ protected:
|
|||
inline NS_METHOD
|
||||
nsStdURL::GetSpec(char* *o_Spec)
|
||||
{
|
||||
return DupString(o_Spec, mSpec);
|
||||
return DupString(o_Spec, mSpec);
|
||||
}
|
||||
|
||||
inline NS_METHOD
|
||||
nsStdURL::GetScheme(char* *o_Scheme)
|
||||
{
|
||||
return DupString(o_Scheme, mScheme);
|
||||
return DupString(o_Scheme, mScheme);
|
||||
}
|
||||
|
||||
inline NS_METHOD
|
||||
nsStdURL::GetPreHost(char* *o_PreHost)
|
||||
{
|
||||
return DupString(o_PreHost, mPreHost);
|
||||
return DupString(o_PreHost, mPreHost);
|
||||
}
|
||||
|
||||
inline NS_METHOD
|
||||
nsStdURL::GetHost(char* *o_Host)
|
||||
{
|
||||
return DupString(o_Host, mHost);
|
||||
return DupString(o_Host, mHost);
|
||||
}
|
||||
|
||||
inline NS_METHOD
|
||||
nsStdURL::GetPath(char* *o_Path)
|
||||
{
|
||||
return DupString(o_Path, mPath);
|
||||
return DupString(o_Path, mPath);
|
||||
}
|
||||
|
||||
inline NS_METHOD
|
||||
nsStdURL::GetDirectory(char* *o_Directory)
|
||||
{
|
||||
return DupString(o_Directory, mDirectory);
|
||||
return DupString(o_Directory, mDirectory);
|
||||
}
|
||||
|
||||
inline NS_METHOD
|
||||
nsStdURL::GetFileName(char* *o_FileName)
|
||||
{
|
||||
return DupString(o_FileName, mFileName);
|
||||
return DupString(o_FileName, mFileName);
|
||||
}
|
||||
|
||||
inline NS_METHOD
|
||||
nsStdURL::GetRef(char* *o_Ref)
|
||||
{
|
||||
return DupString(o_Ref, mRef);
|
||||
return DupString(o_Ref, mRef);
|
||||
}
|
||||
|
||||
inline NS_METHOD
|
||||
nsStdURL::GetParam(char **o_Param)
|
||||
{
|
||||
return DupString(o_Param, mParam);
|
||||
return DupString(o_Param, mParam);
|
||||
}
|
||||
|
||||
inline NS_METHOD
|
||||
nsStdURL::GetQuery(char* *o_Query)
|
||||
{
|
||||
return DupString(o_Query, mQuery);
|
||||
return DupString(o_Query, mQuery);
|
||||
}
|
||||
|
||||
inline NS_METHOD
|
||||
nsStdURL::SetScheme(char* i_Scheme)
|
||||
{
|
||||
if (mScheme) nsCRT::free(mScheme);
|
||||
nsresult status = DupString(&mScheme, i_Scheme);
|
||||
ReconstructSpec();
|
||||
return status;
|
||||
nsresult status = DupString(&mScheme, i_Scheme);
|
||||
ReconstructSpec();
|
||||
return status;
|
||||
}
|
||||
|
||||
inline NS_METHOD
|
||||
nsStdURL::SetPreHost(char* i_PreHost)
|
||||
{
|
||||
if (mPreHost) nsCRT::free(mPreHost);
|
||||
nsresult status = DupString(&mPreHost, i_PreHost);
|
||||
ReconstructSpec();
|
||||
return status;
|
||||
nsresult status = DupString(&mPreHost, i_PreHost);
|
||||
ReconstructSpec();
|
||||
return status;
|
||||
}
|
||||
|
||||
inline NS_METHOD
|
||||
nsStdURL::SetHost(char* i_Host)
|
||||
{
|
||||
if (mHost) nsCRT::free(mHost);
|
||||
nsresult status = DupString(&mHost, i_Host);
|
||||
ReconstructSpec();
|
||||
return status;
|
||||
nsresult status = DupString(&mHost, i_Host);
|
||||
ReconstructSpec();
|
||||
return status;
|
||||
}
|
||||
|
||||
inline NS_METHOD
|
||||
nsStdURL::GetPort(PRInt32 *aPort)
|
||||
{
|
||||
if (aPort)
|
||||
{
|
||||
*aPort = mPort;
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
if (aPort)
|
||||
{
|
||||
*aPort = mPort;
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
inline NS_METHOD
|
||||
nsStdURL::SetPort(PRInt32 aPort)
|
||||
{
|
||||
mPort = aPort;
|
||||
ReconstructSpec();
|
||||
return NS_OK;
|
||||
mPort = aPort;
|
||||
ReconstructSpec();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#endif // nsStdURL_h__
|
||||
|
|
|
@ -41,7 +41,7 @@ interface nsIHTTPChannel : nsIChannel
|
|||
*/
|
||||
string GetRequestHeader(in nsIAtom headerAtom);
|
||||
void SetRequestHeader(in nsIAtom headerAtom, in string value);
|
||||
nsISimpleEnumerator GetRequestHeaderEnumerator();
|
||||
nsISimpleEnumerator GetRequestHeaderEnumerator();
|
||||
|
||||
void SetRequestMethod(in unsigned long method);
|
||||
// NS_IMETHOD SetRequestMethod(HTTPMethod i_Method=HM_GET) = 0;
|
||||
|
@ -57,7 +57,7 @@ interface nsIHTTPChannel : nsIChannel
|
|||
protocol instance.
|
||||
*/
|
||||
string GetResponseHeader(in nsIAtom headerAtom);
|
||||
nsISimpleEnumerator GetResponseHeaderEnumerator();
|
||||
nsISimpleEnumerator GetResponseHeaderEnumerator();
|
||||
|
||||
readonly attribute unsigned long ResponseStatus;
|
||||
|
||||
|
|
|
@ -27,27 +27,27 @@
|
|||
[uuid(8D9430E0-0FB4-11d3-9DE6-0010A4053FD0)]
|
||||
interface nsIHTTPNotify : nsINetNotify {
|
||||
/* Before an HTTP request is sent to the server, this method is called.
|
||||
* The implementor of this method can the chose to set any additional
|
||||
* headers for this request before the request is actually sent to the
|
||||
* server. The HTTP PI (protocol interpreter) blocks on this call until
|
||||
* it returns.
|
||||
* The implementor of this method can the chose to set any additional
|
||||
* headers for this request before the request is actually sent to the
|
||||
* server. The HTTP PI (protocol interpreter) blocks on this call until
|
||||
* it returns.
|
||||
*
|
||||
* ARGUMENTS:
|
||||
* aContext: An nsISupports pointer, that should be queried for nsIHTTPChannel.
|
||||
* aContext: An nsISupports pointer, that should be queried for nsIHTTPChannel.
|
||||
*
|
||||
* RETURNS: nsresult
|
||||
*/
|
||||
*/
|
||||
void ModifyRequest(in nsISupports aContext);
|
||||
|
||||
/* After an HTTP server response is received, this method is called
|
||||
* asyncronously. The implementor can interrogate the nsIHTTPChannel as
|
||||
* it deems necessary. The HTTP PI (protocol interpreter) doesn't wait
|
||||
* for this method to return.
|
||||
*
|
||||
* ARGUMENTS:
|
||||
* aContext: An nsISupport pointer, that should be queried for nsIHTTPChannel.
|
||||
*
|
||||
* RETURNS: nsresult
|
||||
*/
|
||||
void AsyncExamineResponse(in nsISupports aContext);
|
||||
};
|
||||
/* After an HTTP server response is received, this method is called
|
||||
* asyncronously. The implementor can interrogate the nsIHTTPChannel as
|
||||
* it deems necessary. The HTTP PI (protocol interpreter) doesn't wait
|
||||
* for this method to return.
|
||||
*
|
||||
* ARGUMENTS:
|
||||
* aContext: An nsISupport pointer, that should be queried for nsIHTTPChannel.
|
||||
*
|
||||
* RETURNS: nsresult
|
||||
*/
|
||||
void AsyncExamineResponse(in nsISupports aContext);
|
||||
};
|
||||
|
|
|
@ -38,4 +38,5 @@ typedef enum _HTTPStates
|
|||
DONE
|
||||
} HTTPStates;
|
||||
|
||||
#endif //_kHTTPStates_h_
|
||||
#endif //_kHTTPStates_h_
|
||||
|
||||
|
|
|
@ -287,8 +287,8 @@ nsHTTPChannel::GetContentType(char * *aContentType)
|
|||
}
|
||||
|
||||
// if all else fails treat it as text/html?
|
||||
if (!*aContentType)
|
||||
*aContentType = nsCRT::strdup(DUMMY_TYPE);
|
||||
if (!*aContentType)
|
||||
*aContentType = nsCRT::strdup(DUMMY_TYPE);
|
||||
if (!*aContentType) {
|
||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
} else {
|
||||
|
@ -372,8 +372,8 @@ nsHTTPChannel::GetResponseStatus(PRUint32 *o_Status)
|
|||
{
|
||||
if (!mConnected)
|
||||
Open();
|
||||
if (mResponse)
|
||||
return mResponse->GetStatus(o_Status);
|
||||
if (mResponse)
|
||||
return mResponse->GetStatus(o_Status);
|
||||
return NS_ERROR_FAILURE; // NS_ERROR_NO_RESPONSE_YET ?
|
||||
}
|
||||
|
||||
|
@ -382,8 +382,8 @@ nsHTTPChannel::GetResponseString(char* *o_String)
|
|||
{
|
||||
if (!mConnected)
|
||||
Open();
|
||||
if (mResponse)
|
||||
return mResponse->GetStatusString(o_String);
|
||||
if (mResponse)
|
||||
return mResponse->GetStatusString(o_String);
|
||||
return NS_ERROR_FAILURE; // NS_ERROR_NO_RESPONSE_YET ?
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ class nsIChannel;
|
|||
class nsHTTPChannel;
|
||||
|
||||
class nsHTTPHandler : public nsIHTTPProtocolHandler
|
||||
//, public nsIProxy
|
||||
//, public nsIProxy
|
||||
{
|
||||
|
||||
public:
|
||||
|
@ -69,7 +69,7 @@ public:
|
|||
|
||||
/*
|
||||
The GetScheme function uniquely identifies the scheme this handler
|
||||
is associated with.
|
||||
is associated with.
|
||||
*/
|
||||
NS_IMETHOD GetScheme(char * *o_Scheme)
|
||||
{
|
||||
|
@ -101,7 +101,7 @@ public:
|
|||
|
||||
/*
|
||||
Get and Set the Proxy Port
|
||||
-1 on Set call indicates switch to default port
|
||||
-1 on Set call indicates switch to default port
|
||||
*/
|
||||
NS_IMETHOD_(PRInt32)
|
||||
GetProxyPort(void) const {return NS_ERROR_NOT_IMPLEMENTED;};
|
||||
|
@ -139,9 +139,9 @@ protected:
|
|||
nsHTTPHandler(void);
|
||||
virtual ~nsHTTPHandler();
|
||||
|
||||
// This is the array of connections that the handler thread maintains to
|
||||
// This is the array of connections that the handler thread maintains to
|
||||
// verify unique requests.
|
||||
nsCOMPtr<nsISupportsArray> mConnections;
|
||||
nsCOMPtr<nsISupportsArray> mConnections;
|
||||
nsCOMPtr<nsISupportsArray> mPendingChannelList;
|
||||
nsCOMPtr<nsISupportsArray> mTransportList;
|
||||
};
|
||||
|
|
|
@ -43,7 +43,7 @@ extern PRLogModuleInfo* gHTTPLog;
|
|||
#endif /* PR_LOGGING */
|
||||
|
||||
nsHTTPRequest::nsHTTPRequest(nsIURI* i_pURL, HTTPMethod i_Method,
|
||||
nsIChannel* i_pTransport):
|
||||
nsIChannel* i_pTransport):
|
||||
mMethod(i_Method),
|
||||
mVersion(HTTP_ONE_ZERO),
|
||||
mRequest(nsnull)
|
||||
|
@ -58,14 +58,14 @@ nsHTTPRequest::nsHTTPRequest(nsIURI* i_pURL, HTTPMethod i_Method,
|
|||
mTransport = i_pTransport;
|
||||
NS_IF_ADDREF(mTransport);
|
||||
|
||||
// Send Host header by default
|
||||
if (HTTP_ZERO_NINE != mVersion)
|
||||
{
|
||||
nsXPIDLCString host;
|
||||
NS_ASSERTION(mURI, "No URI for the request!!");
|
||||
mURI->GetHost(getter_Copies(host));
|
||||
// Send Host header by default
|
||||
if (HTTP_ZERO_NINE != mVersion)
|
||||
{
|
||||
nsXPIDLCString host;
|
||||
NS_ASSERTION(mURI, "No URI for the request!!");
|
||||
mURI->GetHost(getter_Copies(host));
|
||||
SetHeader(nsHTTPAtoms::Host, host);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nsHTTPRequest::~nsHTTPRequest()
|
||||
|
@ -284,10 +284,10 @@ nsHTTPRequest::Build()
|
|||
}
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIInputStream> stream;
|
||||
NS_ASSERTION(mConnection, "Hee ha!");
|
||||
if (NS_FAILED(mConnection->GetPostDataStream(getter_AddRefs(stream))))
|
||||
return NS_ERROR_FAILURE;
|
||||
nsCOMPtr<nsIInputStream> stream;
|
||||
NS_ASSERTION(mConnection, "Hee ha!");
|
||||
if (NS_FAILED(mConnection->GetPostDataStream(getter_AddRefs(stream))))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
// Currently nsIPostStreamData contains the header info and the data.
|
||||
// So we are forced to putting this here in the end.
|
||||
|
@ -295,34 +295,34 @@ nsHTTPRequest::Build()
|
|||
// TODO- Gagan
|
||||
|
||||
if (stream)
|
||||
{
|
||||
NS_ASSERTION(mMethod == HM_POST, "Post data without a POST method?");
|
||||
{
|
||||
NS_ASSERTION(mMethod == HM_POST, "Post data without a POST method?");
|
||||
|
||||
PRUint32 length;
|
||||
stream->GetLength(&length);
|
||||
PRUint32 length;
|
||||
stream->GetLength(&length);
|
||||
|
||||
// TODO Change reading from nsIInputStream to nsIBuffer
|
||||
char* tempBuff = new char[length+1];
|
||||
if (!tempBuff)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
if (NS_FAILED(stream->Read(tempBuff, length, &length)))
|
||||
// TODO Change reading from nsIInputStream to nsIBuffer
|
||||
char* tempBuff = new char[length+1];
|
||||
if (!tempBuff)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
if (NS_FAILED(stream->Read(tempBuff, length, &length)))
|
||||
{
|
||||
NS_ASSERTION(0, "Failed to read post data!");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
tempBuff[length] = '\0';
|
||||
PRUint32 writtenLength;
|
||||
out->Write(tempBuff, length, &writtenLength);
|
||||
out->Write(tempBuff, length, &writtenLength);
|
||||
#ifdef DEBUG_gagan
|
||||
printf(tempBuff);
|
||||
#endif
|
||||
// ASSERT that you wrote length = stream's length
|
||||
// ASSERT that you wrote length = stream's length
|
||||
NS_ASSERTION(writtenLength == length, "Failed to write post data!");
|
||||
}
|
||||
delete[] tempBuff;
|
||||
}
|
||||
}
|
||||
delete[] tempBuff;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
@ -344,14 +344,14 @@ nsHTTPRequest::Build()
|
|||
NS_METHOD
|
||||
nsHTTPRequest::Clone(const nsHTTPRequest* *o_Request) const
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
nsHTTPRequest::SetMethod(HTTPMethod i_Method)
|
||||
{
|
||||
mMethod = i_Method;
|
||||
return NS_OK;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
HTTPMethod
|
||||
|
@ -363,13 +363,13 @@ nsHTTPRequest::GetMethod(void) const
|
|||
NS_METHOD
|
||||
nsHTTPRequest::SetPriority()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
nsHTTPRequest::GetPriority()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ nsresult nsHTTPResponse::GetContentLength(PRInt32* o_Value)
|
|||
nsXPIDLCString value;
|
||||
nsAutoString str;
|
||||
|
||||
mHeaders.GetHeader(nsHTTPAtoms::Content_Length, getter_Copies(value));
|
||||
mHeaders.GetHeader(nsHTTPAtoms::Content_Length, getter_Copies(value));
|
||||
str = value;
|
||||
*o_Value = str.ToInteger(&err);
|
||||
return NS_OK;
|
||||
|
|
|
@ -100,7 +100,7 @@ nsHTTPResponseListener::OnDataAvailable(nsIChannel* channel,
|
|||
nsresult rv = NS_OK;
|
||||
PRUint32 actualBytesRead;
|
||||
NS_ASSERTION(i_pStream, "No stream supplied by the transport!");
|
||||
nsCOMPtr<nsIBufferInputStream> bufferInStream = do_QueryInterface(i_pStream);
|
||||
nsCOMPtr<nsIBufferInputStream> bufferInStream = do_QueryInterface(i_pStream);
|
||||
|
||||
PR_LOG(gHTTPLog, PR_LOG_DEBUG,
|
||||
("nsHTTPResponseListener::OnDataAvailable [this=%x].\n"
|
||||
|
@ -153,7 +153,7 @@ nsHTTPResponseListener::OnDataAvailable(nsIChannel* channel,
|
|||
#else
|
||||
rv = ParseHTTPHeader(bufferInStream, i_Length, &actualBytesRead);
|
||||
#endif
|
||||
NS_ASSERTION(i_Length - actualBytesRead <= i_Length, "wrap around");
|
||||
NS_ASSERTION(i_Length - actualBytesRead <= i_Length, "wrap around");
|
||||
i_Length -= actualBytesRead;
|
||||
}
|
||||
|
||||
|
@ -806,13 +806,12 @@ nsresult nsHTTPResponseListener::ProcessRedirection(PRInt32 aStatusCode)
|
|||
if (NS_SUCCEEDED(rv)) {
|
||||
|
||||
#if defined(PR_LOGGING)
|
||||
char *newURLSpec;
|
||||
|
||||
newURLSpec = nsnull;
|
||||
char *newURLSpec = nsnull;
|
||||
newURL->GetSpec(&newURLSpec);
|
||||
PR_LOG(gHTTPLog, PR_LOG_DEBUG,
|
||||
("ProcessRedirect [this=%x].\tRedirecting to: %s.\n",
|
||||
this, newURLSpec));
|
||||
CRTFREEIF(newURLSpec);
|
||||
#endif /* PR_LOGGING */
|
||||
#if 0
|
||||
// Expanded inline to avoid linking with neckoutils.... (temporary)
|
||||
|
|
Загрузка…
Ссылка в новой задаче