title: HttpClient high data usage when getting remote file size
body: <p>I'm getting the file size of remote urls and I just noticed the difference between HttpClient and httpWebRequest.</p>
  <p>I compared and I noticed that httpclient is taking too much data.
  this is a big issue for me because, in the Philippines we are only have limited data</p>
  <p>Could you please tell me what's wrong with my httpclient class? I can't figure out what is causing the high data usage</p>
  <p>HttpClient</p>
  <pre><code>       HttpClientHandler handler = new HttpClientHandler()
          {
              Proxy = null,
              UseProxy = false,
              AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate
          };
  
          var client = new HttpClient(handler);
  
          client.DefaultRequestHeaders.Add(&quot;Method&quot;, &quot;GET&quot;);
          client.DefaultRequestHeaders.Add(&quot;Referer&quot;, uriPath.AbsoluteUri);
          client.DefaultRequestHeaders.Add(&quot;Origin&quot;, &quot;https://www.samplesite.com&quot;);
          client.DefaultRequestHeaders.ConnectionClose = true;
          client.DefaultRequestHeaders.UserAgent.ParseAdd(&quot;Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36&quot;);
          client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue(&quot;application/json&quot;));
          client.DefaultRequestHeaders.AcceptEncoding.Add(new StringWithQualityHeaderValue(&quot;gzip&quot;));
          client.DefaultRequestHeaders.AcceptEncoding.Add(new StringWithQualityHeaderValue(&quot;deflate&quot;));
  
          using (HttpResponseMessage response = await client.GetAsync(uriPath, HttpCompletionOption.ResponseHeadersRead, token).ConfigureAwait(false))
          {
              response.EnsureSuccessStatusCode();
              return await response.Content.ReadAsStringAsync();
              var resultTask = response.Content.ReadAsStringAsync();
              var timeoutTask = Task.Delay(3000);
  
              var completed = await Task.WhenAny(resultTask, timeoutTask).ConfigureAwait(false);
  
              if (completed == timeoutTask)
                  return null;
  
              return await resultTask;
          }
  </code></pre>
  <p>HttpWebRequest</p>
  <pre><code>      var webRequest = (HttpWebRequest)WebRequest.Create(uriPath);
          webRequest.Method = &quot;HEAD&quot;;
          webRequest.UserAgent = &quot;Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36&quot;;
  
          using (var webResponse = await webRequest.GetResponseAsync())
          {
              return await Task.Run(() =&gt; webResponse.Headers.Get(&quot;Content-Length&quot;), token);
          }
  </code></pre>