Jump to content

GillesL.

Members
  • Content Count

    10
  • Joined

  • Last visited

Community Reputation

0 Neutral

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. GillesL.

    SslHttpClient Post problem

    First app migration to Rest was easy and works. One issue but I think it is server side. Working on 2d app, looks good so far. So much easier! Thanks for the help.
  2. GillesL.

    SslHttpClient Post problem

    The problem was with th TSSLContext. I duplicated the settings from the sample code and everything worked. The issue was in the SSLOptions I am not sure which one was causing the problem: [sslOpt_MICROSOFT_SESS_ID_BUG,sslOpt_NETSCAPE_CHALLENGE_BUG,sslOpt_NETSCAPE_REUSE_CIPHER_CHANGE_BUG,sslOpt_MICROSOFT_BIG_SSLV3_BUFFER,sslOpt_SSLEAY_080_CLIENT_DH_BUG,sslOpt_TLS_D5_BUG,sslOpt_TLS_BLOCK_PADDING_BUG,sslOpt_TLS_ROLLBACK_BUG,sslOpt_NO_SSLv2,sslOpt_NO_SSLv3,sslOpt_NETSCAPE_CA_DN_BUG,sslOpt_NETSCAPE_DEMO_CIPHER_CHANGE_BUG] I do appreciated the suggestion about using Rest instead and I will rewrite my code to do so. Thanks for the response.
  3. Can someone point me out in the right direction please. I used the following code in 2 different programs. One works the other fails because the "Document" file does not get created... const Document : string = 'c:\temp\rcvdata.txt'; function TForm5.PostURL(URL, HeaderKey, HeaderValue, Data: string): string; var S: TStringList; begin if FileExists(Document) then DeleteFile(Document); S:= TStringList.Create; try if HeaderKey <> '' then begin SslHttpCli1.ExtraHeaders.Add(HeaderKey + ': ' + HeaderValue); end; SslHttpCli1.SendStream := TMemoryStream.Create; SslHttpCli1.SendStream.Write(Data[1], Length(Data)); SslHttpCli1.SendStream.Seek(0, 0); SslHttpCli1.RcvdStream := TMemoryStream.Create; //not to sure about this see HTTPDocBegin SslHttpCli1.URL := Trim(URL); SslHttpCli1.ContentTypePost := 'application/json'; SslHttpCli1.Post; S.LoadFromFile(Document); Result:= S.Text; Memo1.Lines.Add('DATA SENT:'); Memo1.Lines.Add(Data); Memo1.Lines.Add('RESPONSE:'); Memo1.Lines.Add(Result); finally S.Free; end; end; procedure TForm5.SslHttpCli1BeforeHeaderSend(Sender: TObject; const Method: string; Headers: TStrings); begin Memo1.Lines.Add('HEADERS:'); Memo1.Lines.add(Headers.text); end; procedure TForm5.SslHttpCli1DocBegin(Sender: TObject); begin FByteCount:= 0; SslHttpCli1.RcvdStream := TFileStream.Create(Document, fmCreate); end; procedure TForm5.SslHttpCli1DocData(Sender: TObject; Buffer: Pointer; Len: Integer); begin Inc(FByteCount, Len); end; procedure TForm5.SslHttpCli1DocEnd(Sender: TObject); begin if Assigned(SslHttpCli1.RcvdStream) then begin SslHttpCli1.RcvdStream.Free; SslHttpCli1.RcvdStream := nil; end; end;
  4. GillesL.

    SmtpReady

    Thanks. I did not realize that the property "State" was published, which makes it easier so I do not have to modify the source.
  5. GillesL.

    SmtpReady

    Windows 10, icsv864, Delphi 10.4, VCL app using SMTPClient... I have an app which runs in the background and must send an email (unattended) when a certain event takes place. From time to time the app stops because the component is not smtpReady: procedure TCustomSmtpClient.CheckReady; begin if not (FState in [smtpReady, smtpInternalReady]) then raise SmtpException.Create('SMTP component not ready'); end; Is it possible to have a quiet exception, no need for user to click OK, and have the app recover and continue to work. Anyone has experience with something like this: procedure TCustomSmtpClient.CheckReady; begin while not (FState in [smtpReady, smtpInternalReady]) then begin Application.ProcessMessages; //not sure if it is warranted Sleep(1000); //maybe 100 would be sufficient end; end; Or maybe a better solution...
  6. Fixed the problem... it was a simple port issue.
  7. I developed an app under Windows 10. If I try to run it under windows 7 when I try to send an email I get this error on connect: RequestDone Rq=0 Error: Winsock - Interrupted system call Is there something to change on the old windows 7 box? Any help would be appreciated.
  8. GillesL.

    TSslSmtpCli in Console App

    I followed the example and used the TSslSmtpCli component instead and it works fine. Thanks for the input.
  9. GillesL.

    TSslSmtpCli in Console App

    Thanks. I will give it a go.
  10. I am having a problem using TSslSmtpCli (v8.55) in a console app (cgi) under windows 10 and Delphi Tokyo (10.2.3). The problem is I can not assign a procedure (created as a TSmtpRequestDone) to the event OnRequestDone since procedures and methods are not compatible. Using a Form provides a mechanism to do so but creates another problem since the app is a console app and I end up with a run time error 216 as the app terminates. Is there any other way other than creating a new component using TCustomSslSmtpCli as a base.
×