Changed uses of nsIBufferInputStream::Fill to nsIBuffer::Write.
git-svn-id: svn://10.0.0.236/trunk@38962 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -862,7 +862,8 @@ nsFtpConnectionThread::Run() {
|
||||
while ( !NS_FAILED(rv) && bytes > 0) {
|
||||
PRUint32 writeCnt = 0;
|
||||
|
||||
rv = in->Fill(listBuf, bytes, &writeCnt);
|
||||
// rv = in->Fill(listBuf, bytes, &writeCnt);
|
||||
rv = buf->Write(listBuf, bytes, &writeCnt);
|
||||
if (NS_FAILED(rv)) {
|
||||
mState = FTP_ERROR;
|
||||
break;
|
||||
@@ -978,7 +979,8 @@ nsFtpConnectionThread::Run() {
|
||||
while ( !NS_FAILED(rv) && bytes > 0) {
|
||||
PRUint32 writeCnt = 0;
|
||||
|
||||
rv = in->Fill(listBuf, bytes, &writeCnt);
|
||||
// rv = in->Fill(listBuf, bytes, &writeCnt);
|
||||
rv = buf->Write(listBuf, bytes, &writeCnt);
|
||||
if (NS_FAILED(rv)) {
|
||||
mState = FTP_ERROR;
|
||||
break;
|
||||
|
||||
@@ -98,13 +98,12 @@ nsHTTPRequest::Build()
|
||||
}
|
||||
|
||||
// Create the Input Stream for writing the request...
|
||||
nsIBuffer* buf;
|
||||
rv = NS_NewBuffer(&buf, NS_HTTP_REQUEST_SEGMENT_SIZE,
|
||||
nsCOMPtr<nsIBuffer> buf;
|
||||
rv = NS_NewBuffer(getter_AddRefs(buf), NS_HTTP_REQUEST_SEGMENT_SIZE,
|
||||
NS_HTTP_REQUEST_BUFFER_SIZE, nsnull);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = NS_NewBufferInputStream(&m_Request, buf);
|
||||
NS_RELEASE(buf);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
//
|
||||
@@ -131,8 +130,10 @@ nsHTTPRequest::Build()
|
||||
("\tnsHTTPRequest [this=%x].\tFirst line: %s",
|
||||
this, lineBuffer.GetBuffer()));
|
||||
|
||||
rv = m_Request->Fill(lineBuffer.GetBuffer(), lineBuffer.Length(),
|
||||
rv = buf->Write(lineBuffer.GetBuffer(), lineBuffer.Length(),
|
||||
&bytesWritten);
|
||||
// rv = m_Request->Fill(lineBuffer.GetBuffer(), lineBuffer.Length(),
|
||||
// &bytesWritten);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
/* switch (m_Method)
|
||||
@@ -176,15 +177,18 @@ nsHTTPRequest::Build()
|
||||
("\tnsHTTPRequest [this=%x].\t\t%s\n",
|
||||
this, lineBuffer.GetBuffer()));
|
||||
|
||||
rv = m_Request->Fill(lineBuffer.GetBuffer(), lineBuffer.Length(),
|
||||
rv = buf->Write(lineBuffer.GetBuffer(), lineBuffer.Length(),
|
||||
&bytesWritten);
|
||||
// rv = m_Request->Fill(lineBuffer.GetBuffer(), lineBuffer.Length(),
|
||||
// &bytesWritten);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
lineBuffer.Truncate();
|
||||
}
|
||||
|
||||
// Write the final \r\n
|
||||
rv = m_Request->Fill(CRLF, PL_strlen(CRLF), &bytesWritten);
|
||||
rv = buf->Write(CRLF, PL_strlen(CRLF), &bytesWritten);
|
||||
// rv = m_Request->Fill(CRLF, PL_strlen(CRLF), &bytesWritten);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
PR_LOG(gHTTPLog, PR_LOG_DEBUG,
|
||||
|
||||
@@ -218,7 +218,8 @@ Simulated_nsFileTransport_Run(nsReader* reader, const char* path)
|
||||
while (PR_TRUE) {
|
||||
PRUint32 amt;
|
||||
/* id'l change to FillFrom... */
|
||||
rv = bufStr->FillFrom(fileStr, spec.GetFileSize(), &amt);
|
||||
// rv = bufStr->FillFrom(fileStr, spec.GetFileSize(), &amt);
|
||||
rv = buf->WriteFrom(fileStr, spec.GetFileSize(), &amt);
|
||||
if (rv == NS_BASE_STREAM_EOF) {
|
||||
rv = NS_OK;
|
||||
break;
|
||||
|
||||
@@ -146,7 +146,7 @@ TestHTTPEventSink::OnHeadersAvailable(nsISupports* context)
|
||||
//optimize later TODO allow atoms here...! intead of just the header strings
|
||||
pHTTPCon->GetContentType(&type);
|
||||
if (type) {
|
||||
printf("\nRecieving ... %s\n", type);
|
||||
printf("\nReceiving ... %s\n", type);
|
||||
nsCRT::free(type);
|
||||
}
|
||||
}
|
||||
@@ -282,10 +282,10 @@ InputTestConsumer::OnStopRequest(nsIChannel* channel,
|
||||
|
||||
printf("\nFinished loading: %s Status Code: %x\n", info->Name(), aStatus);
|
||||
printf("\tRead: %d bytes.\n", info->mBytesRead);
|
||||
printf("\tTime to connect: %f seconds\n", connectTime);
|
||||
printf("\tTime to read: %f seconds.\n", readTime);
|
||||
printf("\tTime to connect: %.3f seconds\n", connectTime);
|
||||
printf("\tTime to read: %.3f seconds.\n", readTime);
|
||||
if (readTime > 0.0) {
|
||||
printf("\tThroughput: %f bps.\n", (info->mBytesRead*8)/readTime);
|
||||
printf("\tThroughput: %.0f bps.\n", (info->mBytesRead*8)/readTime);
|
||||
} else {
|
||||
printf("\tThroughput: REAL FAST!!\n");
|
||||
}
|
||||
|
||||
@@ -229,7 +229,8 @@ main(int argc, char* argv[])
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
char *buffer = PR_smprintf("GET %s HTML/1.0%s%s", fileName, CRLF, CRLF);
|
||||
stream->Fill(buffer, strlen(buffer), &bytesWritten);
|
||||
// stream->Fill(buffer, strlen(buffer), &bytesWritten);
|
||||
buf->Write(buffer, strlen(buffer), &bytesWritten);
|
||||
printf("\n+++ Request is: %s\n", buffer);
|
||||
|
||||
// Create the socket transport...
|
||||
|
||||
@@ -109,7 +109,7 @@ InputTestConsumer::OnStopRequest(nsIChannel* channel,
|
||||
const PRUnichar* aMsg)
|
||||
{
|
||||
gKeepRunning = 0;
|
||||
printf("+++ OnStopRequest +++\n");
|
||||
printf("+++ OnStopRequest status %x +++\n", aStatus);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -57,8 +57,6 @@ static nsITimer* gPeriodicTimer;
|
||||
|
||||
void Pump_PLEvents(void)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
while ( gKeepRunning ) {
|
||||
#ifdef WIN32
|
||||
MSG msg;
|
||||
@@ -73,6 +71,7 @@ void Pump_PLEvents(void)
|
||||
#ifdef XP_MAC
|
||||
/* Mac stuff is missing here! */
|
||||
#else
|
||||
nsresult rv;
|
||||
PLEvent *gEvent;
|
||||
rv = gEventQ->GetEvent(&gEvent);
|
||||
rv = gEventQ->HandleEvent(gEvent);
|
||||
@@ -125,6 +124,7 @@ public:
|
||||
nsresult Resume(void);
|
||||
|
||||
protected:
|
||||
nsIBuffer* mBuffer;
|
||||
nsIBufferInputStream* mStream;
|
||||
|
||||
nsIInputStream* mInStream;
|
||||
@@ -202,6 +202,7 @@ TestConnection::TestConnection(const char* aHostName, PRInt32 aPort, PRBool aAsy
|
||||
mBytesRead = 0;
|
||||
|
||||
mTransport = nsnull;
|
||||
mBuffer = nsnull;
|
||||
mStream = nsnull;
|
||||
|
||||
mInStream = nsnull;
|
||||
@@ -217,9 +218,8 @@ TestConnection::TestConnection(const char* aHostName, PRInt32 aPort, PRBool aAsy
|
||||
if (mIsAsync) {
|
||||
// Create a stream for the data being written to the server...
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsIBuffer* buf;
|
||||
rv = NS_NewBuffer(&buf, 1024, 4096, nsnull);
|
||||
rv = NS_NewBufferInputStream(&mStream, buf);
|
||||
rv = NS_NewBuffer(&mBuffer, 1024, 4096, nsnull);
|
||||
rv = NS_NewBufferInputStream(&mStream, mBuffer);
|
||||
}
|
||||
}
|
||||
// Synchronous transport...
|
||||
@@ -236,6 +236,7 @@ TestConnection::~TestConnection()
|
||||
NS_IF_RELEASE(mTransport);
|
||||
// Async resources...
|
||||
NS_IF_RELEASE(mStream);
|
||||
NS_IF_RELEASE(mBuffer);
|
||||
|
||||
// Sync resources...
|
||||
NS_IF_RELEASE(mInStream);
|
||||
@@ -355,7 +356,8 @@ nsresult TestConnection::WriteBuffer(void)
|
||||
// Async case...
|
||||
//
|
||||
if (mStream) {
|
||||
rv = mStream->Fill(buffer, size, &bytesWritten);
|
||||
// rv = mStream->Fill(buffer, size, &bytesWritten);
|
||||
rv = mBuffer->Write(buffer, size, &bytesWritten);
|
||||
|
||||
// Write the buffer to the server...
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
|
||||
Reference in New Issue
Block a user