title: Timeout in multipart download
body: <p>I'm working on a C# winform application that is downloading by multypart asynchronously.
  But, some of part catch request time out error. i try to start fiddler application while my application working. My application work properly and complating download operation for all part.
  What effect does Fiddler have on the program's proper functioning?
  Is there something I missed from the code I wrote?</p>
  
  <pre><code>namespace Vektorel.DownloadManager
  {
      public partial class Form1 : Form
      {
          public Form1()
          {
              InitializeComponent();
              nmPartCount.Value = Environment.ProcessorCount;
              CheckForIllegalCrossThreadCalls = false;
          }
  
          void AddControl(FlowLayoutPanel panel, ucDownloadStatus download)
          {
              if (panel.InvokeRequired)
              {
                  panel.Invoke(new Action&lt;FlowLayoutPanel, ucDownloadStatus&gt;(AddControl), panel, download);
              }
              else
              {
                  panel.Controls.Add(download);
              }
          }
  
          void JoinParts()
          {
              DirectoryInfo di = new DirectoryInfo(Application.StartupPath);
              //exenin çalıştığı yerdeki part dosyalarının listesini alalım.
              FileInfo[] files = di.GetFiles().Where(f=&gt;f.Name.Contains(".part")).ToArray();
              //partları birleştirmek için gereken stream
              FileStream fs = new FileStream(Path.GetFileName(txtUrl.Text), FileMode.Create);
  
  
              foreach (FileInfo file in files)
              {
                  //ilgili part'a ait stream.
                  FileStream partStream = new FileStream(file.Name, FileMode.Open);
                  partStream.CopyTo(fs);
              }
              fs.Flush();
              fs.Close();
          }
  
  
  
          private void btnStartDownload_Click(object sender, EventArgs e)
          {
              HttpWebRequest requestForFileSize = (HttpWebRequest)HttpWebRequest.Create(txtUrl.Text);
              requestForFileSize.Method = "HEAD";
              long totalBytes = Convert.ToInt64(requestForFileSize.GetResponse().Headers["Content-Length"]);
              long partCount = Convert.ToInt64(nmPartCount.Value);
              long partSize = totalBytes / partCount;
              long startIndex = 0;
              Thread[] downloadThreads = new Thread[partCount];
              for (int i = 1; i &lt;= partCount; i++)
              {
  
                  HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(txtUrl.Text);
                  request.Method = "GET";
  
                  string partName = string.Format("part-{0}.part", i);
  
                  if (i == partCount)
                  {
                      partSize = totalBytes - startIndex;
                      request.AddRange(startIndex);                    
                  }
                  else
                  {
                      request.AddRange(startIndex, startIndex + partSize);
                  }
  
                  startIndex = startIndex + partSize ;
  
                  listBox1.Items.Add(totalBytes);
                  listBox1.Items.Add(string.Format("{0} {1}", partName, partSize));
  
                  downloadThreads[i - 1] = new Thread(() =&gt;
                    {
                        byte[] buffer = new byte[1024];
                        FileStream fs = new FileStream(partName, FileMode.Create);
  
                        ucDownloadStatus downloadStatus = new ucDownloadStatus();
                        downloadStatus.PartName = partName;
  
                        AddControl(flowDownloadProgress, downloadStatus);
  
                        using (WebResponse response = request.GetResponse())
                        {
                            using (var responseStream = response.GetResponseStream())
                            {
                                int openedBytesLength = 0;
                                long totalBytesReceived = 0;
                                while ((openedBytesLength = responseStream.Read(buffer, 0, buffer.Length)) &gt; 0)
                                {
                                    fs.Write(buffer, 0, openedBytesLength);
                                    totalBytesReceived += openedBytesLength;
                                    int progressValue = (int)(totalBytesReceived * 100 / partSize);
                                    downloadStatus.Progress = progressValue;
                                    fs.Flush();
                                }
                            }
                        }
                        fs.Close();
                    });
              }
  
              for (int i = 0; i &lt; downloadThreads.Length; i++)
              {
                  downloadThreads[i].Start();
              }
  
              var complatedThread = new Thread(() =&gt;
              {
                  for (int i = 0; i &lt; downloadThreads.Length; i++)
                  {
                      downloadThreads[i].Join();
                  }
                  JoinParts();
              });
              complatedThread.Start();
  
          }
      }
  }
  </code></pre>