I have one URLs that works just fine in all browsers (5 tested on 2 computers), but if I try to get the page content using Get() of the Indy Http client, it returns error code 404, page not found. This is with the latest Indy SVN build (4985).
Why does this web server return code 404 for Indy, but code 200 for every browser?
I suspect this may be a bug in Indy because of the "#" character in the URL (Indy cuts everything off after #). If so, is there any way to work-around this. Maybe replace the # char with escape code?
Here is my example code. All that is needed for this is Delphi with Indy components and a form with a button and a memo.
procedure TForm1.Button1Click(Sender: TObject);
var HTTPCLIENT1: TIdHTTP;
begin
try
try
HTTPCLIENT1 := TIdHTTP.Create(nil);
Memo1.Clear;
with HTTPCLIENT1 do
begin
HandleRedirects := True;
Request.UserAgent := 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.64 Safari/537.31';
Memo1.Text := Get('http://www.visionofhumanity.org/gpi-data/#/2011/scor/');
Caption := ResponseText;
end;
except
On e: Exception do
begin
Memo1.Lines.Add('Exception: '+e.Message);
end;
end;
finally
HTTPCLIENT1.Free;
end;
end;
#
and everything after it would not be sent to the server anymore. I will double check again, but it was definately working correctly last time. – Remy Lebeau