Solved

INDY / Delphi assign IdHTTP

Posted on 2010-11-16
1
741 Views
Last Modified: 2012-05-10
I'm writing a multi threaded application with Indys idHttp. To work the cookies (and perhaps more)  from the base object must be present in the other threads. Fine, I thought and tried the "assign" method. But the result was an error:

Cant assign a idHttp to a HTtp ... So what i need is to copy the properties of one IdHTTP to another.
0
Comment
Question by:Sunsales
1 Comment
 
LVL 32

Accepted Solution

by:
ewangoya earned 500 total points
ID: 34151836

Create a class helper and use it to copy the properties

type
  TIdHTTPHelper = class(TObject)
  public
    class procedure Assign(ASource, ADestination: TIdHTTP);
  end;

implementation

{ TIdHTTPHelper }

class procedure TIdHTTPHelper.Assign(ASource, ADestination: TIdHTTP);
begin
  ADestination.MaxAuthRetries := ASource.MaxAuthRetries;
  ADestination.AllowCookies := ASource.AllowCookies;
  //Add other properties you need
  ..........
end;

you can just call it as
TIdHTTPHelper.Assign(idHTTP1, idHTTP2);
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

896 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now