зеркало из https://github.com/mozilla/pjs.git
bug 752648 - fix regression with restarting due to tls intolerance r=honzab
--HG-- extra : rebase_source : 8155ae4c221df4c5931816fb8773123cc37dd148
This commit is contained in:
Родитель
c2b17d4018
Коммит
285f985254
|
@ -66,7 +66,7 @@ class SpdySession : public nsAHttpTransaction
|
|||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSAHTTPTRANSACTION
|
||||
NS_DECL_NSAHTTPCONNECTION
|
||||
NS_DECL_NSAHTTPCONNECTION(mConnection)
|
||||
NS_DECL_NSAHTTPSEGMENTREADER
|
||||
NS_DECL_NSAHTTPSEGMENTWRITER
|
||||
|
||||
|
|
|
@ -153,9 +153,13 @@ public:
|
|||
// Read and write class of transaction that is carried on this connection
|
||||
virtual nsAHttpTransaction::Classifier Classification() = 0;
|
||||
virtual void Classify(nsAHttpTransaction::Classifier newclass) = 0;
|
||||
|
||||
// The number of transaction bytes written out on this HTTP Connection, does
|
||||
// not count CONNECT tunnel setup
|
||||
virtual PRInt64 BytesWritten() = 0;
|
||||
};
|
||||
|
||||
#define NS_DECL_NSAHTTPCONNECTION \
|
||||
#define NS_DECL_NSAHTTPCONNECTION(fwdObject) \
|
||||
nsresult OnHeadersAvailable(nsAHttpTransaction *, nsHttpRequestHead *, nsHttpResponseHead *, bool *reset); \
|
||||
nsresult ResumeSend(); \
|
||||
nsresult ResumeRecv(); \
|
||||
|
@ -176,6 +180,8 @@ public:
|
|||
nsISocketTransport *Transport(); \
|
||||
PRUint32 CancelPipeline(nsresult originalReason); \
|
||||
nsAHttpTransaction::Classifier Classification(); \
|
||||
void Classify(nsAHttpTransaction::Classifier);
|
||||
void Classify(nsAHttpTransaction::Classifier); \
|
||||
PRInt64 BytesWritten() \
|
||||
{ return fwdObject ? (fwdObject)->BytesWritten() : 0; }
|
||||
|
||||
#endif // nsAHttpConnection_h__
|
||||
|
|
|
@ -79,6 +79,7 @@ nsHttpConnection::nsHttpConnection()
|
|||
, mCurrentBytesRead(0)
|
||||
, mMaxBytesRead(0)
|
||||
, mTotalBytesRead(0)
|
||||
, mTotalBytesWritten(0)
|
||||
, mKeepAlive(true) // assume to keep-alive by default
|
||||
, mKeepAliveMask(true)
|
||||
, mSupportsPipelining(false) // assume low-grade server
|
||||
|
@ -1194,8 +1195,11 @@ nsHttpConnection::OnReadSegment(const char *buf,
|
|||
mSocketOutCondition = rv;
|
||||
else if (*countRead == 0)
|
||||
mSocketOutCondition = NS_BASE_STREAM_CLOSED;
|
||||
else
|
||||
else {
|
||||
mSocketOutCondition = NS_OK; // reset condition
|
||||
if (!mProxyConnectInProgress)
|
||||
mTotalBytesWritten += *countRead;
|
||||
}
|
||||
|
||||
return mSocketOutCondition;
|
||||
}
|
||||
|
|
|
@ -182,6 +182,8 @@ public:
|
|||
// When the connection is active this is called every second
|
||||
void ReadTimeoutTick();
|
||||
|
||||
PRInt64 BytesWritten() { return mTotalBytesWritten; }
|
||||
|
||||
private:
|
||||
// called to cause the underlying socket to start speaking SSL
|
||||
nsresult ProxyStartSSL();
|
||||
|
@ -239,6 +241,7 @@ private:
|
|||
PRInt64 mCurrentBytesRead; // data read per activation
|
||||
PRInt64 mMaxBytesRead; // max read in 1 activation
|
||||
PRInt64 mTotalBytesRead; // total data read
|
||||
PRInt64 mTotalBytesWritten; // does not include CONNECT tunnel
|
||||
|
||||
nsRefPtr<nsIAsyncInputStream> mInputOverflow;
|
||||
|
||||
|
|
|
@ -379,7 +379,7 @@ private:
|
|||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSAHTTPCONNECTION
|
||||
NS_DECL_NSAHTTPCONNECTION(mConn)
|
||||
|
||||
nsConnectionHandle(nsHttpConnection *conn) { NS_ADDREF(mConn = conn); }
|
||||
virtual ~nsConnectionHandle();
|
||||
|
|
|
@ -53,7 +53,7 @@ class nsHttpPipeline : public nsAHttpConnection
|
|||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSAHTTPCONNECTION
|
||||
NS_DECL_NSAHTTPCONNECTION(mConnection)
|
||||
NS_DECL_NSAHTTPTRANSACTION
|
||||
NS_DECL_NSAHTTPSEGMENTREADER
|
||||
|
||||
|
|
|
@ -725,7 +725,15 @@ nsHttpTransaction::Close(nsresult reason)
|
|||
// mReceivedData == FALSE. (see bug 203057 for more info.)
|
||||
//
|
||||
if (reason == NS_ERROR_NET_RESET || reason == NS_OK) {
|
||||
if (!mReceivedData && (!mSentData || connReused || mPipelinePosition)) {
|
||||
|
||||
// reallySentData is meant to separate the instances where data has
|
||||
// been sent by this transaction but buffered at a higher level while
|
||||
// a TLS session (perhaps via a tunnel) is setup.
|
||||
bool reallySentData =
|
||||
mSentData && (!mConnection || mConnection->BytesWritten());
|
||||
|
||||
if (!mReceivedData &&
|
||||
(!reallySentData || connReused || mPipelinePosition)) {
|
||||
// if restarting fails, then we must proceed to close the pipe,
|
||||
// which will notify the channel that the transaction failed.
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче