MCPcopy Create free account
hub / github.com/Predelnik/DSpellCheck / ReadHttpResponse

Method ReadHttpResponse

deps/FtpClient/BlockingSocket.cpp:441–463  ·  view source on GitHub ↗

reads remainder of a transmission through buffer full or socket close (assume headers have been read already)

Source from the content-addressed store, hash-verified

439// reads remainder of a transmission through buffer full or socket close
440// (assume headers have been read already)
441int CHttpBlockingSocket::ReadHttpResponse(char* pch, int nSize, int nSecs)
442{
443 int nBytesToRead, nBytesThisTime, nBytesRead = 0;
444
445 if( m_nReadBuf>0)
446 { // copy anything already in the recv buffer
447 memcpy(pch, m_pReadBuf, m_nReadBuf);
448 pch += m_nReadBuf;
449 nBytesRead = m_nReadBuf;
450 m_nReadBuf = 0;
451 }
452 do
453 { // now pass the rest of the data directly to the caller
454 nBytesToRead = std::min(static_cast<int>(nSizeRecv), nSize - nBytesRead);
455 nBytesThisTime = Receive(pch, nBytesToRead, nSecs);
456 if( nBytesThisTime<=0 )
457 break; // sender closed the socket
458 pch += nBytesThisTime;
459 nBytesRead += nBytesThisTime;
460 } while( nBytesRead<=nSize );
461
462 return nBytesRead;
463}
464
465std::unique_ptr<IBlockingSocket> nsSocket::CreateDefaultBlockingSocketInstance()
466{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected