title: How can I get the TNMHTTP Get method to respond on a redirect
body: <p>I'm using TNMHTTP in Delphi to retrieve the code from a webpage. The code is relatively simple:</p>
  
  <pre><code>NMHTTP1 := TNMHTTP.Create(Self);
  NMHTTP1.InputFileMode := FALSE;
  NMHTTP1.OutputFileMode := FALSE;
  NMHTTP1.ReportLevel := Status_Basic;
  NMHTTP1.TimeOut := 3000;
  
  URL := 'http://www....';
  NMHTTP1.Get(URL); 
  S := NMHTTP1.Body;
  </code></pre>
  
  <p>I am catching exceptions in a try/except block, but that is not the problem.</p>
  
  <p>The problem is that on executing the NMHTTP1.Get method when the URL is a redirect, that method does not return and the program hangs. This is despite the fact that I've put a timeout of 3000 seconds in.</p>
  
  <p>So I see three possible ways of solving this (in order of easiest to hardest for me to modify my program):  </p>
  
  <ol>
  <li><p>Do whatever is necessary to get the NMHTTP1.Get method to respond.</p></li>
  <li><p>Do some sort of check in advance of the NMHTTP1.Get statement to see if the URL is a redirect and get the URL it is redirecting to.</p></li>
  <li><p>Use another method to get a webpage using Delphi. When I wrote this, I used Delphi 4 and did not have Indy. I now have Delphi 2009, so I would be willing to use something that works in it (maybe INDY) if a simple #1 or #2 answer is not available.</p></li>
  </ol>
  
  <p>I would love to get an answer from someone that will work for me. Thanks in advance.</p>