mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-12 12:55:46 +00:00
removing hard coded "http" string and using GetScheme() instead.
cleaning up a memory leak
This commit is contained in:
parent
f13ed0caa9
commit
3c1d894f1c
@ -66,7 +66,7 @@ NS_METHOD NS_CreateOrGetHTTPHandler(nsIHTTPProtocolHandler* *o_HTTPHandler)
|
|||||||
gHTTPLog = PR_NewLogModule("nsHTTPProtocol");
|
gHTTPLog = PR_NewLogModule("nsHTTPProtocol");
|
||||||
}
|
}
|
||||||
#endif /* PR_LOGGING */
|
#endif /* PR_LOGGING */
|
||||||
|
|
||||||
if (o_HTTPHandler)
|
if (o_HTTPHandler)
|
||||||
{
|
{
|
||||||
*o_HTTPHandler = nsHTTPHandler::GetInstance();
|
*o_HTTPHandler = nsHTTPHandler::GetInstance();
|
||||||
@ -118,7 +118,8 @@ nsHTTPHandler::NewChannel(const char* verb, nsIURI* i_URL,
|
|||||||
{
|
{
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
nsHTTPChannel* pChannel = nsnull;
|
nsHTTPChannel* pChannel = nsnull;
|
||||||
char* scheme = 0;
|
char* scheme = nsnull;
|
||||||
|
char* handlerScheme = nsnull;
|
||||||
|
|
||||||
// Initial checks...
|
// Initial checks...
|
||||||
if (!i_URL || !o_Instance) {
|
if (!i_URL || !o_Instance) {
|
||||||
@ -126,7 +127,17 @@ nsHTTPHandler::NewChannel(const char* verb, nsIURI* i_URL,
|
|||||||
}
|
}
|
||||||
|
|
||||||
i_URL->GetScheme(&scheme);
|
i_URL->GetScheme(&scheme);
|
||||||
if (0 == PL_strcasecmp(scheme, "http")) {
|
GetScheme(&handlerScheme);
|
||||||
|
|
||||||
|
if (scheme != nsnull && handlerScheme != nsnull &&
|
||||||
|
0 == PL_strcasecmp(scheme, handlerScheme))
|
||||||
|
{
|
||||||
|
if (scheme)
|
||||||
|
nsCRT::free(scheme);
|
||||||
|
|
||||||
|
if (handlerScheme)
|
||||||
|
nsCRT::free(handlerScheme);
|
||||||
|
|
||||||
nsCOMPtr<nsIURI> channelURI;
|
nsCOMPtr<nsIURI> channelURI;
|
||||||
PRUint32 count;
|
PRUint32 count;
|
||||||
PRInt32 index;
|
PRInt32 index;
|
||||||
@ -171,6 +182,12 @@ nsHTTPHandler::NewChannel(const char* verb, nsIURI* i_URL,
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (scheme)
|
||||||
|
nsCRT::free(scheme);
|
||||||
|
|
||||||
|
if (handlerScheme)
|
||||||
|
nsCRT::free(handlerScheme);
|
||||||
|
|
||||||
NS_ERROR("Non-HTTP request coming to HTTP Handler!!!");
|
NS_ERROR("Non-HTTP request coming to HTTP Handler!!!");
|
||||||
//return NS_ERROR_MISMATCHED_URL;
|
//return NS_ERROR_MISMATCHED_URL;
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
Loading…
Reference in New Issue
Block a user