title: InternetReadFile returns corrupted response
body: <p>Am doing a GET(REST) and using InternetReadFile API to read response which is an xml, it works fine when the response is small but when the response is more then 10kb InternetReadFile returns data with junk characters in between or it chops some portion of data. When i try to reconstruct the response due to presence of junk character or due to lack of some portion the resulting xml would be corrupt.</p>
  
  <p>If i make the same GET call using fiddler then am getting proper response.</p>
  
  <p>Here is the code snippet  </p>
  
  <pre><code>m_internetsession = InternetOpen("RestToolkit",INTERNET_OPEN_TYPE_PRECONFIG ,NULL,NULL,0);
  if(m_internetsession == NULL)
  {
      throw new exception ("InternetOpen call failed");
  }
  m_connection = InternetConnect(m_internetsession,m_uri.Gethost().c_str(),(INTERNET_PORT)m_uri.Getport(),"", "", INTERNET_SERVICE_HTTP, 0, 0);
  </code></pre>
  
  <p>HINTERNET request =  HttpOpenRequest(m_connection,m_method.c_str(),m_uri.Getrelativepath().c_str(),NULL,NULL,NULL,0,0);</p>
  
  <p>Read response:</p>
  
  <pre><code> #define HTTP_BUFFER_LENGTH 1024
      if(response.empty())
      {
          CHAR szBuff[HTTP_BUFFER_LENGTH+1];
          memset(szBuff,0x00,sizeof(szBuff));
          DWORD bytesRead;
          while (InternetReadFile(request,szBuff, HTTP_BUFFER_LENGTH,&amp;bytesRead) == TRUE &amp;&amp; bytesRead &gt; 0)
          {
              response.append(szBuff);
              memset(szBuff,0x00,sizeof(szBuff));
          }
      }
  </code></pre>
  
  <p>What am i doing wrong?</p>
  
  <p>Thanks 
  JeeL</p>