bug 760608 alternatve 1 preconnect problem with SSL r=honzab

This commit is contained in:
Patrick McManus 2012-06-06 15:47:45 -04:00
Родитель 22d31cce71
Коммит 6b69dcf1a3
2 изменённых файлов: 26 добавлений и 12 удалений

Просмотреть файл

@ -19,7 +19,7 @@ NullHttpTransaction::NullHttpTransaction(nsHttpConnectionInfo *ci,
nsIEventTarget *target, nsIEventTarget *target,
PRUint8 caps) PRUint8 caps)
: mStatus(NS_OK) : mStatus(NS_OK)
, mCaps(caps) , mCaps(caps | NS_HTTP_ALLOW_KEEPALIVE)
, mCallbacks(callbacks) , mCallbacks(callbacks)
, mEventTarget(target) , mEventTarget(target)
, mConnectionInfo(ci) , mConnectionInfo(ci)

Просмотреть файл

@ -1587,19 +1587,31 @@ nsHttpConnectionMgr::DispatchAbstractTransaction(nsConnectionEntry *ent,
/* Use pipeline datastructure even if connection does not currently qualify /* Use pipeline datastructure even if connection does not currently qualify
to pipeline this transaction because a different pipeline-eligible to pipeline this transaction because a different pipeline-eligible
transaction might be placed on the active connection */ transaction might be placed on the active connection. Make an exception
for CLASS_SOLO as that connection will never pipeline until it goes
quiescent */
nsRefPtr<nsHttpPipeline> pipeline; nsRefPtr<nsAHttpTransaction> transaction;
nsresult rv = BuildPipeline(ent, aTrans, getter_AddRefs(pipeline)); nsresult rv;
if (!NS_SUCCEEDED(rv)) if (conn->Classification() != nsAHttpTransaction::CLASS_SOLO) {
return rv; LOG((" using pipeline datastructure.\n"));
nsRefPtr<nsHttpPipeline> pipeline;
rv = BuildPipeline(ent, aTrans, getter_AddRefs(pipeline));
if (!NS_SUCCEEDED(rv))
return rv;
transaction = pipeline;
}
else {
LOG((" not using pipeline datastructure due to class solo.\n"));
transaction = aTrans;
}
nsRefPtr<nsConnectionHandle> handle = new nsConnectionHandle(conn); nsRefPtr<nsConnectionHandle> handle = new nsConnectionHandle(conn);
// give the transaction the indirect reference to the connection. // give the transaction the indirect reference to the connection.
pipeline->SetConnection(handle); transaction->SetConnection(handle);
rv = conn->Activate(pipeline, caps, priority); rv = conn->Activate(transaction, caps, priority);
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
LOG((" conn->Activate failed [rv=%x]\n", rv)); LOG((" conn->Activate failed [rv=%x]\n", rv));
ent->mActiveConns.RemoveElement(conn); ent->mActiveConns.RemoveElement(conn);
@ -1610,13 +1622,13 @@ nsHttpConnectionMgr::DispatchAbstractTransaction(nsConnectionEntry *ent,
// sever back references to connection, and do so without triggering // sever back references to connection, and do so without triggering
// a call to ReclaimConnection ;-) // a call to ReclaimConnection ;-)
pipeline->SetConnection(nsnull); transaction->SetConnection(nsnull);
NS_RELEASE(handle->mConn); NS_RELEASE(handle->mConn);
// destroy the connection // destroy the connection
NS_RELEASE(conn); NS_RELEASE(conn);
} }
// As pipeline goes out of scope it will drop the last refernece to the // As transaction goes out of scope it will drop the last refernece to the
// pipeline if activation failed, in which case this will destroy // pipeline if activation failed, in which case this will destroy
// the pipeline, which will cause each the transactions owned by the // the pipeline, which will cause each the transactions owned by the
// pipeline to be restarted. // pipeline to be restarted.
@ -2643,8 +2655,10 @@ nsHalfOpenSocket::OnOutputStreamReady(nsIAsyncOutputStream *out)
// if we are using ssl and no other transactions are waiting right now, // if we are using ssl and no other transactions are waiting right now,
// then form a null transaction to drive the SSL handshake to // then form a null transaction to drive the SSL handshake to
// completion. Afterwards the connection will be 100% ready for the next // completion. Afterwards the connection will be 100% ready for the next
// transaction to use it. // transaction to use it. Make an exception for SSL over HTTP proxy as the
if (mEnt->mConnInfo->UsingSSL() && !mEnt->mPendingQ.Length()) { // NullHttpTransaction does not know how to drive CONNECT.
if (mEnt->mConnInfo->UsingSSL() && !mEnt->mPendingQ.Length() &&
!mEnt->mConnInfo->UsingHttpProxy()) {
LOG(("nsHalfOpenSocket::OnOutputStreamReady null transaction will " LOG(("nsHalfOpenSocket::OnOutputStreamReady null transaction will "
"be used to finish SSL handshake on conn %p\n", conn.get())); "be used to finish SSL handshake on conn %p\n", conn.get()));
nsRefPtr<NullHttpTransaction> trans = nsRefPtr<NullHttpTransaction> trans =