Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Oct 08 19:00

    Fulgan on Restructure

    Bug fix for a typo in TIdIMAP4.… (compare)

  • Oct 08 19:00

    Fulgan on master

    Bug fix for a typo in TIdIMAP4.… (compare)

  • Oct 02 21:00

    Fulgan on Restructure

    Updating TIdIMAP4's InternalSea… (compare)

  • Oct 02 21:00

    Fulgan on master

    Updating TIdIMAP4's InternalSea… (compare)

  • Sep 20 21:50

    Fulgan on master

    Embarcadero patch for race cond… (compare)

  • Sep 20 21:50

    Fulgan on Restructure

    Embarcadero patch for race cond… (compare)

  • Sep 10 18:50
    rlebeau closed #268
  • Sep 10 18:50
    rlebeau commented #268
  • Sep 10 18:50

    Fulgan on Restructure

    Fix for TIdResponseHeaderInfo.S… (compare)

  • Sep 10 18:50

    Fulgan on master

    Fix for TIdResponseHeaderInfo.S… (compare)

  • Sep 10 18:49
    rlebeau labeled #268
  • Sep 10 18:49
    rlebeau labeled #268
  • Sep 10 18:49
    rlebeau assigned #268
  • Sep 10 18:49
    rlebeau review_requested #268
  • Sep 09 13:15
    gjdoornink opened #268
  • Aug 28 21:00

    Fulgan on Restructure

    Setting TIdSSLIOHandlerSocketBa… (compare)

  • Aug 28 21:00

    Fulgan on master

    Setting TIdSSLIOHandlerSocketBa… (compare)

  • Aug 28 19:42
    rlebeau milestoned #183
  • Aug 28 19:42
    rlebeau demilestoned #183
  • Aug 28 19:42
    rlebeau assigned #183
Remy Lebeau
@rlebeau
@JEisenheim_twitter No, I do not. You would have to get them from the SVN server directly. Have you sniffed the network traffic to make sure that an SSL handshake is taking place? Do you have an OnQuerySSLPort event handler assigned? or at least have TIdTHTTPServer listening on port 443? It is hard to diagnose when I can't see your setup
John
@JEisenheim_twitter
@rlebeau Offtopic: Does the TidHTTPServer use RootCertFile? I have CertFile and KeyFile setup correctly, don't know how RootCertFile is used by the server.
John
@JEisenheim_twitter
The problem is in the IdCustomHTTPServer.pas unit, just copying the old version fixed the problem. I will continue to locate the problem.
Remy Lebeau
@rlebeau
@JEisenheim_twitter yes, RootCertFile is used. If assigned, it gets passed to OpenSSL's SSL_CTX_load_verify_locations() and SSL_CTX_set_client_CA_list() functions.
@JEisenheim_twitter there have been only 2 revisions to IdCustomHTTPServer.pas since rev 5451. In rev 5461 to activate SSL on port 443 by default if no OnQuerySSLPort handler is assigned, and to add some TODO comments. In rev 5480 to add some more TODO coments only.
John
@JEisenheim_twitter
@rlebeau That was..... DoQuerySSLPort now returns false if the port is not 443 and the QuerySSLPort hander is not defined, the old version returned true. Small change in behavior. THANK YOU for your help.
Remy Lebeau
@rlebeau
@JEisenheim_twitter the old code was buggy, if OnQuerySSLPort was not assigned, SSL would be activated on every port, even non-HTTPS ports like the standard HTTP port 80. That was fixed so SSL would be activated only for port 443, which is the standard HTTPS port. If you want to use non-standard HTTPS ports, you have to use OnQuerySSLPort.
John
@JEisenheim_twitter
Hello. Please add the EVP_MD_CTX_create, EVP_MD_CTX_destroy and PEM_read_bio_PUBKEY functions to IdSSLOpenSSLHeaders. Thank you.
Remy Lebeau
@rlebeau
@JEisenheim_twitter added
Jacek
@jaclas

cite from IdException.pas:
"type
// EIdExceptionBase is the base class which extends Exception. It is separate from EIdException
// to allow other users of Indy to use EIdExceptionBase while still being able to separate from
// EIdException.
EIdException = class(Exception)
public"

where is EIdExceptionBase?

Remy Lebeau
@rlebeau
@jaclas EIdExceptionBase was removed from Indy way back in 2007, when the IdSys and IdObjs units were removed from Indy, and IdException was changed to derive from Exception directly instead of EIdExceptionBase. I guess the comment was never updated/removed.
@jaclas I have removed the comment now
mezen
@mezen
Does the global variable "GWindowsStack" in unit IdStackWindows still needed? I use private, short living instances of TIdStackWindows to use HostByAddress and the protected method HostByName, but the constructor of TIdStackWindows stores Self to the global variable. Every time my short living instances are freed, the global variable still holds a dengling pointer :(
Do I have to set the global variable to nil? Or should I use a long living singleton from the global variable?
Remy Lebeau
@rlebeau
@mezen GWindowsStack is only used by the long-deprecated SuperCore package, so technically no, it is not needed anymore. I can mark it as deprecated when I get a chance. However, you really should not be creating your own IdStack objects at all. Use TIdStack.IncUsage() and TIdStack.DecUsage() to let Indy create/destroy its own singleton object for you, and then you can access it with GStack and/or GBSDStack as needed (Indy components do this internally).
mezen
@mezen
When should I use GBSDStack? TIdStack.IncUsage() only fills GStack. GBSDStack seems more like GWindowsStack, TIdStackBSDBase.Create stores Self into it, but I find no consuming (or cleanup).
So, the correct usage should be this way?
  TIdStack.IncUsage();
  try
    ShowMessage(GStack.HostByAddress('192.168.0.1'));
  finally
    TIdStack.DecUsage();
  end;
Remy Lebeau
@rlebeau
@mezen yes, that is the correct usage
@mezen access to GStack and related globals is guaranteed to be valid only when the usage counter is > 0
Remy Lebeau
@rlebeau
@mezen IncUsage instantiates the platform-specific class assigned to GStackClass (TIdStackWindows, TIdStackVCLPosix, etc) and their constructors then set GStack, GBSDStack, GWindowsStack as needed. No, none of them are set to nil when destroyed (such as by DecUsage)
mezen
@mezen
None of them are set to nil? What about
      if GInstanceCount = 0 then begin
        FreeAndNil(GStack);
      end;
Remy Lebeau
@rlebeau
@mezen nevermind
Remy Lebeau
@rlebeau
@mezen I meant none of them are set to nil in destructors
Dave Corbett
@dpcorbett
Hi there, just trying to report a bug, but the link on the website is broken. LSocketList is created in TIdIPMCastListenerThread.Run on line 269. It isn’t freed in the function, but LReadList is twice. We assume this is an oversight, can you please confirm?
Remy Lebeau
@rlebeau
@dpcorbett FYI, Indy's issue tracker is on GitHub: https://github.com/IndySockets/Indy/issues
Remy Lebeau
@rlebeau
@dpcorbett I have just now checked in a fix to Indy's SVN, and it will appear on GitHub shortly.
Dave Corbett
@dpcorbett
@rlebeau Thanks, you’re a legend. 😀
Marcello Bachechi
@pilotkid
Hello all, I was wondering if there are any tutorials on how to use the FTP server for C++ builder? I am not professionally trained with embarcadero and I have spent the majority of my day trying to track down materials. Any suggestions?
Valmeras
@Valmeras
I am using Indy Rad Studio Tokyo 10.2 with Indy 10. Indy components used are TIdSMTP, TIdMessage and TIdSSLIOHandlerSocketOpenSSL. The SSL version I am using for connection TLSv1_2. When I try to connect to the server smtp.gmail.com on port 587, I am getting an "Unknown CA" error message. What can be the reason ?
Valmeras
@Valmeras
SSL status: "before/connect initialization"
AType = Handshake StartMessage = before/connect initialization
SSL status: "before/connect initialization"
AType = Connect LoopMessage = before/connect initialization
SSL status: "SSLv3 write client hello A"
AType = Connect LoopMessage = SSLv3 write client hello A
SSL status: "SSLv3 read server hello A"
AType = Connect LoopMessage = SSLv3 read server hello A
SSL status: "SSLv3 read server certificate B"
AType = fatal Write AlertMessage = unknown CA
SSL status: "error"
AType = Connect ErrorMessage = error
SSL negotiation failed.
mezen
@mezen
OpenSSL does not use the windows certificate store, so you have to tell OpenSSL which CAs are trustworthy. Or you disable the certification verification (most insecure) and every certificate will be accepted
Remy Lebeau
@rlebeau
@pilotkid there are no tutorials, and I am not aware of any demos for TIdFTPServer specifically, so you will have to search through various online discussion forums, or just ask questions here or at https://www.atozed.com/forums/ as needed.
@Valmeras mezen is correct. If you want to perform validation then you need to give OpenSSL certificates to validate against. Though peer validation is disabled by default, and I've never needed to specify any CA certificates when connecting to Gmail. But yes, it is technically less secure as it does not avoid MITM attacks. You need to validate who you are connected to in order to avoid that
mezen
@mezen
I have the following situation: TIdTCPClient connects to a TCP Server, the server sends some data and disconnects (as simple example - in reality there are more communications). If I use TIdTCPClient.Connected, the result is True, because the InputBuffer is not empty. But using TIdTCPClient.CheckForData tells False, because the connection is terminated. Now the question: What is the best nonblocking way to detect: Oh there is data to read.
Remy Lebeau
@rlebeau
@mezen CheckForDataOnSource() ignores the InputBuffer and goes right to the "source" (ie, the socket). What you need to do is check InputBufferIsEmpty() first, and only if True then check CheckForDataOnSource() and CheckForDisconnect(), for example:
if IdTCPClient1.IOHandler.InputBufferIsEmpty then
begin
  IdTCPClient1.IOHandler.CheckForDataOnSource(0);
  IdTCPClient1.IOHandler.CheckForDisconnect;
  if IdTCPClient1.IOHandler.InputBufferIsEmpty then Exit;
end;
// input buffer is not empty here, read as needed...
mezen
@mezen
Thx, will test it tommorow :)
Furma94
@Furma94

Hi @rlebeau
I Search,study and read all your Online Guide about my problem (Indy comp on Delphi) , but i dont find anything useful for me.
I'm a Delphi Dev , using indy 10.6 on Delphi 10.0.3
Now my problem [Deeper]:
My company have a net full of restrictions , i can't install a .dll on users outlook.exe [V.2016] , i can't intercept imap / pop / smtp / or nothing.
And then , the idea comes. (With Idea , i means my last chance to avoid my net restriction).

procedure TFrmMain.FormCreate(Sender: TObject);
begin
  DragAcceptFiles(Handle, True);
end;

With this Handler i allow my form to receive DragAndDrop Items.msg from Outlook 20016.
Drag From outlook -> To Desktop
From Desktop -> To My Form

procedure TFrmMain.WMDropFiles(var Msg: TMessage);
var
  hDrop: THandle;
  FileCount: Integer;
  NameLen: Integer;
  I: Integer;
  S: string;
begin
  hDrop:= Msg.wParam;
  FileCount:= DragQueryFile (hDrop , $FFFFFFFF, nil, 0);
  for I:= 0 to FileCount - 1 do begin
    NameLen:= DragQueryFile(hDrop, I, nil, 0) + 1;
    SetLength(S, NameLen);
    DragQueryFile(hDrop, I, Pointer(S), NameLen);
  end;
  DragFinish(hDrop);
end;

Now that i've My S variable i open it inTidMessage.LoadFromFile(S,False);

Now , i take the Data i need (Subj / From / Body ) with this :

   Var1:=Trim(TidMessage.From.Text);
    Var2:=DateToStr(TidMessage.Date));
    Var3:=TidMessage.Subject;
    if TidMessage.Priority=mpLowest then Var4:=0;
    if TidMessage.Priority=mpLow then Var4:=1;
    if TidMessage.Priority=mpNormal then Var4:=2;
    if TidMessage.Priority=mpHighthen Var4:=3;
    if TidMessage.Priority=mpHighest then Var4:=4;
   Var5:=TidMessage.MsgId;

BUT everytime i try to take attachment (As i use to do with many of my TiDImap4)

  for i := 0 to Messaggio.MessageParts.Count-1 do
  BEGIN
     CODE
   END

Everytime , messageparts.count = 0
Do you know what am i doing Wrong? Or maybe where i can found the solution or the concept i miss?

P.s.
I'm Really sorry for my english , but it's not my native language and i try my best.

Remy Lebeau
@rlebeau
@Furma94 in your WM_DROPFILES handler, when calling SetLength() to allocate S, DO NOT use +1 to include the null terminator. a null terminator is already implicitly included in the allocated memory but not counted by the length. You are allocating a 2nd null terminator and not removing it after populating S, so you are actually passing S+#0 to LoadFromFile(), and that can fail since the #0 would get treated as a character in the requested filename but doesn't exist in the actual file on disk. That being said, if you implement the IDropTarget interface in your Form and use RegisterDragDrop() instead of DragAcceptFiles() then you won't even need to drop emails onto your Desktop at all, you can drag the emails from Outlook directly to your Form instead.
@Furma94 Now, aside form that, the only way that the MessageParts would be 0 is if either 1) there really are no attachments in the email, 2) the email is malformed, or 3) the email not being parsed correctly. I'm leaning towards 3 in your case, but I'm only guessing since you didn't show the actual content of the email files you are trying to load.
Furma94
@Furma94

@rlebeau
@Furma94 in your WM_DROPFILES handler, when calling SetLength() to allocate S, DO NOT use +1 to include the null terminator. a null terminator is already implicitly included in the allocated memory but not counted by the length. You are allocating a 2nd null terminator and not removing it after populating S, so you are actually passing S+#0 to LoadFromFile(), and that can fail since the #0 would get treated as a character in the requested filename but doesn't exist in the actual file on disk.

For this Part , the "Null terminator" , give me the last character of my filename , and i don't find anything to avoid the problem.

That being said, if you implement the IDropTarget interface in your Form and use RegisterDragDrop() instead of DragAcceptFiles() then you won't even need to drop emails onto your Desktop at all, you can drag the emails from Outlook directly to your Form instead."

I'll do it , i follow many other guides (With of course your stackoverflow collabs) and i solve my problem as well.

Thank you very much !

Remy Lebeau
@rlebeau

@Furma94 my point is, a Delphi string is not null-terminated (but can be converted to null-terminated via a PChar() cast when needed). So, when allocating a string, DONT include space for a null terminator in the requested length, as one will be provided implicitly for you. If desired, add + 1 when passing NameLen to the second call to DragQueryFile() instead:

NameLen := DragQueryFile(hDrop, I, nil, 0);
SetLength(S, NameLen);
DragQueryFile(hDrop, I, PChar(S), NameLen + 1);
// use S as needed...

Otherwise, if you include the + 1 when calling SetLength() then you must call SetLength() again to correct the string afterwards:

NameLen := DragQueryFile(hDrop, I, nil, 0) + 1;
SetLength(S, NameLen);
NameLen := DragQueryFile(hDrop, I, PChar(S), NameLen);
SetLength(S, NameLen);
// use S as needed...

The return value of DragQueryFile() DOES NOT include a null terminator.

davidwed
@davidwed
Hello, is it planned to provide an installation project for the RadStudio Rio ( 12.3 => Indy 260 ) ? I have a change to the "IdSSLOpenSSL.pas".
davidwed
@davidwed
The patch is based on the last indy of github.
davidwed
@davidwed
OK, the patch should solve the issue #72
davidwed
@davidwed
My fault, case #72 is different, my patch fixes another memory leak :-)
Remy Lebeau
@rlebeau
@davidwed yes, Rio package files are planned to be checked in eventually, I just haven't had a change to get them ready yet. Thank you for the patch. I see what it is trying to accomplish, but I don't like that it has interface changes across multiple units, so I have now checked in a different fix that requires fewer changes.
DelphiWorlds
@DelphiWorlds
@rlebeau Is there a way of preventing TIdTCPServer from sending the Greeting? I tried making the Code property blank but that didn’t work
Remy Lebeau
@rlebeau
@DelphiWorlds I just answered a similar question this morning in the AtoZed forum: https://www.atozed.com/forums/showthread.php?tid=917 Setting the Greeting.Code to a blank string is the correct solution. You might have to set it at runtime, though. I just tried it at design-time and the blank didn't get preserved. I'll have to look into that.
DelphiWorlds
@DelphiWorlds
wow.. well, it wasn’t me :-)