reads remainder of a transmission through buffer full or socket close (assume headers have been read already)
| 439 | // reads remainder of a transmission through buffer full or socket close |
| 440 | // (assume headers have been read already) |
| 441 | int 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 | |
| 465 | std::unique_ptr<IBlockingSocket> nsSocket::CreateDefaultBlockingSocketInstance() |
| 466 | { |
nothing calls this directly
no outgoing calls
no test coverage detected