зеркало из https://github.com/mozilla/pjs.git
fixes bug 201370 "TLS intolerance detection broken" r=kaie sr=alecf
This commit is contained in:
Родитель
04525e7938
Коммит
2300a4eb4b
|
@ -122,6 +122,7 @@ nsHttpTransaction::nsHttpTransaction()
|
||||||
, mResponseIsComplete(PR_FALSE)
|
, mResponseIsComplete(PR_FALSE)
|
||||||
, mDidContentStart(PR_FALSE)
|
, mDidContentStart(PR_FALSE)
|
||||||
, mNoContent(PR_FALSE)
|
, mNoContent(PR_FALSE)
|
||||||
|
, mSentData(PR_FALSE)
|
||||||
, mReceivedData(PR_FALSE)
|
, mReceivedData(PR_FALSE)
|
||||||
, mStatusEventPending(PR_FALSE)
|
, mStatusEventPending(PR_FALSE)
|
||||||
{
|
{
|
||||||
|
@ -343,7 +344,11 @@ nsHttpTransaction::ReadRequestSegment(nsIInputStream *stream,
|
||||||
PRUint32 *countRead)
|
PRUint32 *countRead)
|
||||||
{
|
{
|
||||||
nsHttpTransaction *trans = (nsHttpTransaction *) closure;
|
nsHttpTransaction *trans = (nsHttpTransaction *) closure;
|
||||||
return trans->mReader->OnReadSegment(buf, count, countRead);
|
nsresult rv = trans->mReader->OnReadSegment(buf, count, countRead);
|
||||||
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
|
trans->mSentData = PR_TRUE;
|
||||||
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
|
@ -444,18 +449,25 @@ nsHttpTransaction::Close(nsresult reason)
|
||||||
mConnected = PR_FALSE;
|
mConnected = PR_FALSE;
|
||||||
|
|
||||||
//
|
//
|
||||||
// if the connection was reset or closed before we read any part of the
|
// if the connection was reset or closed before we wrote any part of the
|
||||||
// response, and if the connection was being reused, then we can assume
|
// request or if we wrote the request but didn't receive any part of the
|
||||||
// that we wrote to a stale connection and we must therefore repeat the
|
// response and the connection was being reused, then we can (and really
|
||||||
// request over a new connection.
|
// should) assume that we wrote to a stale connection and we must therefore
|
||||||
|
// repeat the request over a new connection.
|
||||||
//
|
//
|
||||||
if (!mReceivedData && connReused && (reason == NS_ERROR_NET_RESET ||
|
// NOTE: the conditions under which we will automatically retry the HTTP
|
||||||
reason == NS_OK)) {
|
// request have to be carefully selected to avoid duplication of the
|
||||||
|
// request from the point-of-view of the server. such duplication could
|
||||||
|
// have dire consequences including repeated purchases, etc.
|
||||||
|
//
|
||||||
|
if (reason == NS_ERROR_NET_RESET || reason == NS_OK) {
|
||||||
|
if (!mSentData || (!mReceivedData && connReused)) {
|
||||||
// if restarting fails, then we must proceed to close the pipe,
|
// if restarting fails, then we must proceed to close the pipe,
|
||||||
// which will notify the channel that the transaction failed.
|
// which will notify the channel that the transaction failed.
|
||||||
if (NS_SUCCEEDED(Restart()))
|
if (NS_SUCCEEDED(Restart()))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
PRBool relConn = PR_TRUE;
|
PRBool relConn = PR_TRUE;
|
||||||
if (NS_SUCCEEDED(reason)) {
|
if (NS_SUCCEEDED(reason)) {
|
||||||
|
|
|
@ -185,6 +185,7 @@ private:
|
||||||
PRUint32 mResponseIsComplete : 1;
|
PRUint32 mResponseIsComplete : 1;
|
||||||
PRUint32 mDidContentStart : 1;
|
PRUint32 mDidContentStart : 1;
|
||||||
PRUint32 mNoContent : 1; // expecting an empty entity body
|
PRUint32 mNoContent : 1; // expecting an empty entity body
|
||||||
|
PRUint32 mSentData : 1;
|
||||||
PRUint32 mReceivedData : 1;
|
PRUint32 mReceivedData : 1;
|
||||||
PRUint32 mStatusEventPending : 1;
|
PRUint32 mStatusEventPending : 1;
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче