bug 1029163 - part 3 tunnel https/h1 over h2 could duplicate bytes in upload and corrupt data r=hurley

This commit is contained in:
Patrick McManus 2014-06-24 07:56:08 -04:00
parent 064aa10644
commit 926e563e62

View File

@ -200,15 +200,19 @@ TLSFilterTransaction::OnReadSegment(const char *aData,
uint32_t amt = 0;
if (mEncryptedTextUsed) {
// If we are tunneled on spdy CommitToSegmentSize will prevent partial
// writes that could interfere with multiplexing. H1 is fine with
// partial writes.
rv = mSegmentReader->CommitToSegmentSize(mEncryptedTextUsed, mForce);
if (rv != NS_BASE_STREAM_WOULD_BLOCK) {
rv = mSegmentReader->OnReadSegment(mEncryptedText, mEncryptedTextUsed, &amt);
}
if (rv == NS_BASE_STREAM_WOULD_BLOCK) {
// return OK because all the data was consumed and stored in this buffer
Connection()->TransactionHasDataToWrite(this);
return NS_OK;
}
rv = mSegmentReader->OnReadSegment(mEncryptedText, mEncryptedTextUsed, &amt);
if (NS_FAILED(rv)) {
} else if (NS_FAILED(rv)) {
return rv;
}
}
@ -220,7 +224,6 @@ TLSFilterTransaction::OnReadSegment(const char *aData,
} else {
memmove(mEncryptedText, mEncryptedText + amt, mEncryptedTextUsed - amt);
mEncryptedTextUsed -= amt;
return NS_OK;
}
return NS_OK;
}