Chce napisać prosty server http proxy. Może są do tego jakieś gotowe komponenty ?? dawno nie pisałem w delphi i mam troche problemów. na razie napisałem takie coś :
procedure TForm1.get_host(info : string);
var
i, j : integer;
begin
client.Active:=false;
host:='';
for i:=1 to length(info) do
begin
if (info[i]=':') and (info[i-1]='t') and (info[i-2]='s') and (info[i-3]='o') and (info[i-4]='H') then
begin
j:=i+2;
repeat
host:=host+info[j];
Inc(j);
until info[j+1]=#10;
break;
end;
end;
client.Host:=host;
end;
procedure TForm1.ServerClientRead(Sender: TObject;
Socket: TCustomWinSocket);
var
i : integer;
begin
temp:=Server.Socket.Connections[0].ReceiveText;
memo1.Lines.Add(temp);
if(temp<>'')then
get_host(temp);
client.Active:=true;
end;
procedure TForm1.ClientRead(Sender: TObject; Socket: TCustomWinSocket);
var
s : string;
begin
s:=client.Socket.ReceiveText;
memo2.lines.Add(s);
server.Socket.Connections[0].SendText(s);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
ile:=0;
czy:=true;
end;
procedure TForm1.ClientConnect(Sender: TObject; Socket: TCustomWinSocket);
begin
caption:='polaczony';
client.Socket.SendText(temp);
end;
procedure TForm1.ClientConnecting(Sender: TObject;
Socket: TCustomWinSocket);
begin
form1.Caption:='lacze';
end;
procedure TForm1.ClientDisconnect(Sender: TObject;
Socket: TCustomWinSocket);
begin
caption:='koniec';
client.Active:=false;
server.Socket.Connections[0].Close;
end;
Może ktoś mi powie czemu to proxy działa na stronkach na których jest mało różnych obiektów (np www.google.pl) a na np www.wp.pl załaduje troche obrazków a potem przestaje ... Proszę więc o jakiś przykład, komponent lub naprowadzenie mnie na dobrą drogę :)