procedure TProxy.WebModule1WebActionItem1Action(Sender: TObject;
Request: TWebRequest; Response: TWebResponse;
var Handled: Boolean);
var
mem:tmemorystream;
www: TIdHTTP;
IdCookieManager1: TIdCookieManager;
Werte : TStringStream;
const
server='
http://atom:81';
begin
www:= TIdHTTP.Create(webmodule1);
IdCookieManager1:= TIdCookieManager.Create(www);
mem:=tmemorystream.Create;
[
url]www.CookieManager:=[/
url] IdCookieManager1;
[
url]www.AllowCookies:=true;[/
url]
try
for i:=0
to request.CookieFields.Count-1
do
IdCookieManager1.AddCookie(request.CookieFields.Strings[i],'
/');
werte:=TStringStream.Create(request.Content);
if uppercase(request.Method)='
POST'
then
www.Post(server+anfrage+request.Query ,werte,mem)
else
www.Get(server+anfrage+request.Query ,mem);
for i:=0
to IdCookieManager1.CookieCollection.Count-1
do
with response.Cookies.Add
do
begin
Name:=idCookieManager1.CookieCollection.Items[i].CookieName ;
Value:= IdCookieManager1.CookieCollection.Items[i].value;
expires:=(now)+1000;
Path:='
/';
secure:=false;
end;
mem.Position:=0;
response.ContentStream:=mem;
response.SendResponse;
response.ContentLength:=response.ContentStream.Size;
finally
mem.Free;
[
url]www.Free;[/
url]
IdCookieManager1.Free;
werte.Free;
end;
end;