I heave a new problem with mozilla 1.9.2.23 and gecko
In my onStateChange chrome's function, I try to get the statusCode
when I get a STATE_STOP ans STATE_IS_NETWORK.
what I do for this purpose is:
nsresult rv;
nsCOMPtr<nsIChannel> channel = do_QueryInterface(aRequest);
nsEmbedCString schemeUrlCS;
nsCOMPtr<nsIURI> uri;
channel->GetURI(getter_AddRefs(uri));
if(uri)
{
uri->GetScheme(schemeUrlCS);
}
const char* scheme=schemeUrlCS.get();
String schemeStr=scheme;
nsCOMPtr<nsIHttpChannel>
httpChannel(do_QueryInterface(channel));
if (httpChannel)
{
nsCString header;
nsCString retval;
myResponseStatus = WebBrowserEmbedded::infinite;
httpChannel->GetResponseHeader(header,retval);
rv=httpChannel->GetResponseStatus(&myResponseStatus);
myNavigationDone=false;
}
When the StatusCode is 200 myResponseStatus is 200 otherwise, I get
nothing.
I tried to get the responseHeader, but I've nothing (no datas), in all
cases.. (even with statuscode 200).
I took a look into nsHttpChannel.cpp and nsHttpREsponseHead.cpp (C:
\mozilla-1.9.2.23\netwerk\protocol\http\src)
nsHttpChannel.cpp:
_______________________
NS_IMETHODIMP nsHttpChannel::GetResponseStatus(PRUint32 *value)
{
NS_ENSURE_ARG_POINTER(value);
if (!mResponseHead)
return NS_ERROR_NOT_AVAILABLE;
*value = mResponseHead->Status();
return NS_OK;
}
nsHttpResponseHead.cpp
______________________
status() is a inline function into nsHttpResponseHead.h that returns
mStatus
When I lokk at parseStatusLine, I see that :
if ((mVersion == NS_HTTP_VERSION_0_9) || !(line = PL_strchr(line,
' '))) {
mStatus = 200;
mStatusText.AssignLiteral("OK");
}
I probably am not in such case, so I think I execute the else case.
else {
// Status-Code
mStatus = (PRUint16) atoi(++line);
if (mStatus == 0) {
printf("line=%s\nstatus=%d\n",line,mStatus);
LOG(("mal-formed response status; assuming status =
200\n"));
mStatus = 200;
}
// Reason-Phrase is whatever is remaining of the line
if (!(line = PL_strchr(line, ' '))) {
printf("line=%s\nstatus=%d\n",line,mStatus);
LOG(("mal-formed response status line; assuming statusText
= 'OK'\n"));
mStatusText.AssignLiteral("OK");
}
else
mStatusText = ++line;
}
the line is considered anyway as malformed... and mStatus is not set
when mstatus!=0 ...
What can I do ?
Is there a correction ?
thank's
philippe
_______________________________________________
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding