          nsHttpConnection *conn = nsnull;
 -        for (i = 0; i < count; ++i) {
 +
-+        PRUint32 ind[count];
++        PRUInt32* ind = new PRUInt32[count];
 +        ShuffleRequestOrder(ind, count);
 +       
 +        for (h=0; h<count; ++h) {

-            PRInt32 i, count = ent->mPendingQ.Length();
-            for (i=0; i<count; ++i) {
+            PRInt32 i, h, count = ent->mPendingQ.Length();
+            PRInt32 ind[count];
+            ShuffleRequestOrder((PRUint32*)ind, (PRUint32)count);
+       
+            for (h=0; h<count; ++h) {

             trans = ent->mPendingQ[i];
 
             // When this transaction has already established a half-open
@@ -927,6 +944,7 @@
                               "something mutated pending queue from "
                               "GetConnection()");
         }
+        delete [] ind;
         if (conn) {
             LOG(("  dispatching pending transaction...\n"));
 
@@ -1011,6 +1026,19 @@ nsHttpConnectionMgr::AtActiveConnectionLimit(nsConnectionEntry *ent, PRUint8 cap
         maxPersistConns = mMaxPersistConnsPerHost;
     }
