Yes sir what u said is right. It is there in nsHTTPRequest.cpp but inside
the function
NS_IMETHODIMP nsHTTPPipelinedRequest::OnStopRequest(nsIRequest *request,
nsISupports* aContext,
nsresult aStatus)
on lin 783 as u mnetioned. But i cant find the function call to this method.
Now the nsHTTPPipelinedRequest Object is created inside the function
nsHTTPChannel::Connect()
Here is the part of the function i am showing.
(File:nsHTTPChannel.cpp and starting from line 2029.)
nsHTTPPipelinedRequest *pReq;
if (mState != HS_WAITING_FOR_OPEN)
////This function basically returns the Object of nsHTTPPipelined request.
mHandler->GetPipelinedRequest(this, &pReq);
else
pReq = mPipelinedRequest;
if (pReq) {
if (mState != HS_WAITING_FOR_OPEN)
pReq->AddToPipeline(mRequest);
if (!mPipeliningAllowed)
pReq->SetMustCommit(PR_TRUE);
// if a request stream was provided from SetUploadStream, use it
rv = pReq->WriteRequest(mRequestStream);
if (NS_ERROR_BUSY == rv) {
if (!mPipelinedRequest) {
mPipelinedRequest = pReq;
NS_RELEASE(pReq);
}
mState = HS_WAITING_FOR_OPEN;
return NS_OK;
}
if (!mPipelinedRequest)
NS_RELEASE(pReq);
if (NS_FAILED(rv)) {
mConnected = PR_TRUE;
/// Inside this function the OnStopRequest of mResponsedataListener is
beinng called so before that OnStartRequest should be called.
ResponseCompleted(mResponseDataListener, rv);
return rv;
}
}
As i have said in between these 2 functions i could not find the
OnStartRequest method of mResponseDataListener being called.
Another thing is that as u said nsHTTPServerListener is being ccreated in
line 783 of nsHTTPRequest.cpp . But in that case
nsHTTPPipelinedrequest::Onstoprequest method should be called. i cant find
this call either.
I am sorry that i am bugging u with minute details. but i will be grateful
if u could help me out.
Thanks in advance
Regards
Prasanna
----- Original Message -----
From: Darin Fisher
To: Anandprasanna Gaitonde
Sent: Thursday, 07 June, 2001 12:02 AM
Subject: Re: Regarding nsHTTPChannel
The nsHTTPServerListener is actually created at line 783 of
nsHTTPRequest.cpp.
Anandprasanna Gaitonde wrote:
Sir,I did as u said but i am unable to find the place where
nsHTTPServerListeneris created. I am attaching the file nsHTTPChannel.cpp .
Please let me knowif i am looking at the wrong file. The file sure is
frommozilla-source-0.9.tar.gzAlso i put some functions in my previous mail.
(they are there below). Ienclosed some statements of the code by
"////////"Please let me know if the places where nsDocumentOpenInfo
andnsHTTPFinalListener is getting created as marked by me with "//////"
arecorrect or not. (nsDocumentOpeninfo object is created in function
OpenURIviaof nsURIloader and nsHTTPFinalListener object is created in
functionasyncopen of nsHTTPChannel )
Yes, these are the places where they are created.
Darin
Thanks a lotRegardsPras----- Original Message -----From: "Darin Fisher"
<[EMAIL PROTECTED]>To: "Anandprasanna Gaitonde"
<[EMAIL PROTECTED]>Sent: Tuesday, 05 June, 2001 11:47 PMSubject: Re:
Regarding nsHTTPChannel
nsHTTPServerListener is created in nsHTTPChannel.cpp. I'm not sureexactly
where it is created in that file, but you could just search for"new
nsHTTPServerListener" or just "nsHTTPServerListener" to find
it.DarinAnandprasanna Gaitonde wrote:
Hello sir,Well i tried to find the creation of HTTPServerListener Object but
i
could
find it only in the following function.Is there any other place where an
object of that type is getting created.Becoz i feel that thiis function
does not get executed.(well yes i am rferring to the 0.9 version of source
code. Also note that
i
have just shown below the functions which i was looking
at.)nsHTTPPipelinedRequest::OnStopRequest(nsIRequest *request,
nsISupports*aContext, nsresult
aStatus){ nsresult rv; nsCOMPtr<nsISocketTransport> trans =
do_QueryInterface(mTransport,
&rv);
nsHTTPRequest * req =(nsHTTPRequest *) mRequests->ElementAt(0); rv =
aStatus; LOG(("\nnsHTTPRequest::OnStopRequest() [this=%x], aStatus=%u\n",
this, aStatus)); if (NS_SUCCEEDED(rv)) { PRBool isAlive = PR_TRUE;
if (!mListener && trans) trans->IsAlive(0, &isAlive); if
(isAlive) { // // Write the input stream data to the
server... // if (mInputStream) {
LOG(("nsHTTPRequest [this=%x]. " "Writing PUT/POST data
to the server.\n", this)); rv =
NS_AsyncWriteFromStream(
getter_AddRefs(mCurrentWriteRequest), mTransport,
mInputStream, 0, 0, 0, this,
NS_STATIC_CAST(nsIRequest*,req->mConnection)); /* !
the mInputStream is released below... */ } //
// Prepare to receive the response... // else
{ LOG(("nsHTTPRequest [this=%p]. "
"Finished writing request to server." "\tStatus: %x\n",
this, aStatus)); if (mListener == nsnull) {
///////////////////////////////////////////////////////////////////////////
/
/////////// nsHTTPResponseListener* pListener =
newnsHTTPServerListener( req->mConnection,
mHandler, this,
req->mDoingProxySSLConnect);
///////////////////////////////////////////////////////////////////////////
/
/////////// if (pListener) {
NS_ADDREF(pListener); rv =
mTransport->AsyncRead(pListener, aContext,
0,
(PRUint32) -1, 0,getter_AddRefs(mCurrentReadRequest));
mListener = pListener;
NS_RELEASE(pListener); } else
rv = NS_ERROR_OUT_OF_MEMORY; } mOnStopDone =
PR_TRUE; // write again to see if anything else is queued up
WriteRequest(mInputStream); } } else rv =
NS_ERROR_FAILURE; } // // An error occurred when trying to write the
request to the server! // else { LOG(("nsHTTPRequest [this=%p].
Error writing request to server." "\tStatus: %x\n", this,
aStatus)); rv = aStatus; } // // An error occurred... Finish
the transaction and notify the
consumer
// of the failure... // if (NS_FAILED(rv)) { if
(mTotalProcessed == 0 && mAttempts == 0 && mTotalWritten) { //
the pipeline just started - we still can attempt to
recover
PRUint32 wasKeptAlive = 0; nsresult channelStatus =
NS_OK; if (trans)
trans->GetReuseCount(&wasKeptAlive);
req->mConnection->GetStatus(&channelStatus);
LOG(("nsHTTPRequest::OnStopRequest() [this=%p].
wasKeptAlive=%d,
channelStatus=%x\n", this, wasKeptAlive, channelStatus));
if (wasKeptAlive && NS_SUCCEEDED(channelStatus)) { mMustCommit
= PR_TRUE; mAttempts++; mTotalWritten = 0;
mHandler->ReleaseTransport(mTransport,
nsIHTTPProtocolHandler::DONTRECORD_CAPABILITIES,PR_TRUE);
mTransport = null_nsCOMPtr(); mCurrentWriteRequest = 0;
mCurrentReadRequest = 0; mOnStopDone = PR_TRUE;
rv = WriteRequest(mInputStream); if (NS_SUCCEEDED(rv))
{ NS_IF_RELEASE(req); return
} } } while (req) {
nsCOMPtr<nsIStreamListener> consumer;req!
->mConnection->GetResponseDataListener(getter_AddRefs(consumer));
req->mConnection->ResponseCompleted(consumer, rv); // Notify the
HTTPChannel that the request has finished if (mTransport)
{ nsITransport *p = mTransport; mTransport = 0;
mCurrentWriteRequest = 0; mCurrentReadRequest = 0;
mHandler->ReleaseTransport(p,nsIHTTPProtocolHandler::DONTRECORD_CAPABILITIES
); } NS_IF_RELEASE(req); req = nsnull;
if (NS_SUCCEEDED(AdvanceToNextRequest()))
GetCurrentRequest(&req); } } NS_IF_RELEASE(req); // // These
resouces are no longer needed... // // mRequestBuffer.Truncate();
mInputStream = null_nsCOMPtr(); mOnStopDone = PR_TRUE; if (NS_FAILED(rv)
&& !mListen!
er) mHandler->ReleasePipelinedRequest(this); return rv;}The place
where the object nsDocumentopenInfo is getting created is :NS_IMETHODIMP
nsURILoader::OpenURIVia(nsIChannel *channel,
nsURILoadCommand aCommand, const char *
aWindowTarget, nsISupports *
aOriginalWindowContext,
PRUint32 aLocalIP){ // we need to
create a DocumentOpenInfo object which will go ahead andopen the url // and
discover the content type.... nsresult rv = NS_OK; nsDocumentOpenInfo*
loader = nsnull; if (!channel) return NS_ERROR_NULL_POINTER; // Let the
window context's uriListener know that the open is starting.This // gives
that window a chance to abort the load process.
nsCOMPtr<nsIURIContentListener>winContextListener(do_GetInterface(aOriginalW
indowContext)); if(winContextListener) { // get channel from request
nsCOMPtr<nsIURI> uri; channel->GetURI(getter_AddRefs(uri)); if(uri)
{ PRBool doAbort = PR_FALSE; winContextListener->OnStartURIOpen(uri,
aWindowTarget, &doAbort); if(doAbort) return NS_OK;!
} } nsCAutoString windowTarget(aWindowTarget); nsCOMPtr<nsISupports>
retargetedWindowContext; NS_ENSURE_SUCCESS(GetTarget(channel, windowTarget,
aOriginalWindowContext,
getter_AddRefs(retargetedWindowContext)), NS_ERROR_FAILURE);
/./////////////////////////////////////////////////////////////////////////
/
//////// NS_NEWXPCOM(loader, nsDocumentOpenInfo);
///////////////////////////////////////////////////////////////////////////
/
////// if (!loader) return NS_ERROR_OUT_OF_MEMORY; NS_ADDREF(loader);
nsCOMPtr<nsIInterfaceRequestor> loadCookie;
SetupLoadCookie(retargetedWindowContext, getter_AddRefs(loadCookie));
loader->Init(retargetedWindowContext, aOriginalWindowContext); //
Extra
Info // now instruct the loader to go ahead and open the url rv =
loader->Open(channel, aCommand, windowTarget,retargetedWindowContext);
(This function call finally goes to
asyncopen
of HTTPChannel given
///////////////////////////////////////////////////////////////////////////
/
///////////////////////////////////////////////////////////////////////////
/
///////////////below) NS_RELEASE(loader); return rv;}Also i could find the
place where the object of type nsHTTPFinalListener
is
created. and that isnsHTTPChannel::AsyncOpen(nsIStreamListener *aListener,
nsISupports*aContext){ nsresult rv = NS_OK;
NS_ENSURE_ARG_POINTER(aListener); if (mResponseDataListener) return
NS_ERROR_IN_PROGRESS;
///////////////////////////////////////////////////////////////////////////
/
//////// mResponseDataListener = new nsHTTPFinalListener(this,
//////////
Is this the object on which the OnStartRequest Method is being called???????
aListener,
aContext);//////////////////////////////////////////////////////////////////
///// if (!mResponseDataListener) return NS_ERROR_OUT_OF_MEMORY;
mResponseContext = aContext; // start loading the requested document
Connect();#ifndef MOZ_NEW_CACHE // If the data in the cache hasn't
expired, then there's no need to
talk
// with the server. Create a stream from the cache, synthesizing allthe
// various channel-related events. if (mCachedContentIsValid)
ReadFromCache();#endif return rv;}So please tell me where the
nsHTTPServerListener Object is getting
created.
It would be very helpful if u could point to the source code.Thanking
YouYours sincerelyPras
nsHTTPChannel.cpp Content-Type: application/octet-stream
Content-Encoding: x-uuencode