Solved

INDY / Delphi assign IdHTTP

Posted on 2010-11-16
1
740 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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This video discusses moving either the default database or any database to a new volume.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

708 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

11 Experts available now in Live!

Get 1:1 Help Now