Solved

INDY / Delphi assign IdHTTP

Posted on 2010-11-16
1
745 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:
Ephraim Wangoya 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

713 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