Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jun 21 22:25
    CodehunterWorks commented #299
  • Jun 11 19:38
    RogelioGaytan commented #347
  • Jun 10 15:26
    rlebeau commented #347
  • Jun 10 03:05
    RogelioGaytan opened #347
  • Jun 09 17:06
    rlebeau commented #346
  • Jun 09 14:13
    jonyrh closed #346
  • Jun 09 14:13
    jonyrh commented #346
  • Jun 08 20:39
    rlebeau commented #346
  • Jun 08 20:32

    rlebeau on master

    #346 Updating IdSSLOpenSSLHeade… (compare)

  • Jun 08 19:51
    rlebeau commented #346
  • Jun 08 19:41
    rlebeau commented #346
  • Jun 08 17:37
    jonyrh commented #346
  • Jun 08 17:36
    jonyrh commented #346
  • Jun 08 17:36
    jonyrh commented #346
  • Jun 08 17:35
    jonyrh commented #346
  • Jun 08 17:34
    jonyrh commented #346
  • Jun 08 17:33
    jonyrh commented #346
  • Jun 08 17:33
    jonyrh commented #346
  • Jun 08 17:00
    jonyrh commented #346
  • Jun 08 16:51
    jonyrh commented #346
Júnior
@kholyphoenix1
Hey guys.
Is there a component in Indy 10 that operates as a webSocket?
irawancepu
@irawancepu

Hey guys.
Is there a component in Indy 10 that operates as a webSocket?

https://www.esegece.com/websockets

nighthawk2032
@nighthawk2032
just to notify if someone searches for MQTT using Indy components (and supports FMX) -- there is this: https://github.com/wizinfantry/delphi-mqtt-client -- which seems to work after fixing a little the 'function TMQTT.WriteData(AData: TBytes): boolean;' using proper MemoryStream -- although it is only Alpha version, it does seem to do the basic functionality
Seems to me this repo is a forked version of https://github.com/jamiei/Delphi-TMQTT2 which is the VCL version using Synapse TCP components
nighthawk2032
@nighthawk2032
Just ran basic tests on Win, Android and Linux... all seems to work properly -- (Linux had a little free memory issue when subscribing a topic -- which required try except -- as a fast fix)
Remy Lebeau
@rlebeau
@kholyphoenix1 adding WebSockets to Indy is a todo item, but there are some 3rd party implementations liked to in IndySockets/Indy#201
Remy Lebeau
@rlebeau
@mezen yup, noticed that the other day
nighthawk2032
@nighthawk2032

Do forgive me in advance (cause I did raise the issue before, searching for that thread failed, so I am asking again),. I am trying to load delphi apache module, with indy that need to use openssl -- I compiled openssl 1.0.2k under ubuntu 20.04.

log shows:
OpenSSLVersion: OpenSSL 1.0.2k 26 Jan 2017
WhichFailedToLoad: __ (empty)

I am trying to launch SMTP connection from that module, detail 'tail' log shows:
:
Sent 6/1/21 6:50:06 PM: STARTTLS<EOL>
Recv 6/1/21 6:50:06 PM: 220 2.0.0 Ready to start TLS<EOL>
Recv 6/1/21 6:50:06 PM:
Stat Disconnected.
Stat Disconnected.
Stat Disconnected.
.

Meaning when starting TLS it failed, and got disconnect... any ideas?

Remy Lebeau
@rlebeau
@nighthawk2032 Why 1.0.2k? 1.0.2u was the last in the 1.0.2 series before it reached EOL. Also, are you calling WhichFailedToLoad() before or after the failure? Are you getting any exceptions raised into your code, and if so, which ones? And do you have any OnStatus/Ex handlers assigned to the SSLIOHandler?
nighthawk2032
@nighthawk2032

compiled and using 1.0.2u
Added some log messages here is the output:

--> Connected.
--> [Info] SSL status: "before/connect initialization"
--> [InfoEx] before/connect initialization
--> [Info] SSL status: "before/connect initialization"
--> [InfoEx] before/connect initialization
--> [Info] SSL status: "SSLv3 write client hello A"
--> [InfoEx] SSLv3 write client hello A
--> [Info] SSL status: "SSLv3 read server hello A"
--> [InfoEx] SSLv3 read server hello A
--> [Info] SSL status: "SSLv3 read server certificate A"
--> [InfoEx] SSLv3 read server certificate A
--> [Info] SSL status: "error"
--> [InfoEx] decode error
--> [Info] SSL status: "error"
--> [InfoEx] error
--> Disconnecting.
--> Disconnected.

Remy Lebeau
@rlebeau
@nighthawk2032 looks like maybe the server certificate is failing to decode/validate. Have you tried setting VerifyPeer=false on the SSLIOHandler? Or have an OnVerifyPeer handler that returns true?
nighthawk2032
@nighthawk2032
yes,. tried both cases,. same result
Remy Lebeau
@rlebeau
@nighthawk2032 Have you tried sniffing the network traffic with Wireshark to look at the actual TLS handshake and see if it detects any problems with the certificate?
nighthawk2032
@nighthawk2032
that is interesting... I've detached the code of the send procedure to a Delphi>Linux>Standalone App -- and it did send properly..
So something is getting lost when using this configuration as Delphi>Linux>Apache Module
You've mentioned you aren't that familiar with Delphi>Linux >(And or Apache Modules) -- do you have an idea how can I trace that?
Remy Lebeau
@rlebeau
@nighthawk2032 I do not, sorry. But Indy shouldn't care which environment it is used in, so there has to be another factor at play here
nighthawk2032
@nighthawk2032
is there an issue (guessing here) when apache uses one version of openssl (in the https secure connection) while indy use another openssl version?
Remy Lebeau
@rlebeau
@nighthawk2032 maybe, but if that were true, I would have expected you to see that other version reported by OpenSSLVersion(). Have you looked at the modules that Apache loads? Do they match the same file names that Indy uses to load OpenSSL?
nighthawk2032
@nighthawk2032

I am trying to compare the log of the Linux standalone vs apache module...
The standalone log say the following:

Recv 02/06/2021 0:29:52: 220 2.0.0 Ready to start TLS<EOL>
Sent 02/06/2021 0:29:52: EHLO nighthawk-VirtualBox<EOL>

EHLO {name} -- where does it take the name from? maybe this is faulty on the apache module compilation?

checking the modules apache loads..
nighthawk2032
@nighthawk2032
seems to me apache uses openssl 1.1.1f while the compiled Delphi module uses 1.0.2u -- (I am setting the specific directory/lib to indy so it'll use it -- because indy do not support yet 1.1.1 -- and you mentioned before [If I am not mistaken])
btw; the 'nighthawk-VirtualBox' is the name of this ubuntu machine name
Remy Lebeau
@rlebeau
@nighthawk2032 An SMTP client cannot send a new EHLO after STARTTLS unless the TLS handshake is successful. Indy gets the EHLO parameter from the OS if the TIdSMTP.HeloName property is blank (which it is by default). And no, Indy does not officially support OpenSSL 1.1.x yet, but that work is in progress, you can use this SSLIOHandler for 1.1.x support.
nighthawk2032
@nighthawk2032
I am trying to recompile Apache using the same set of Openssl 1.0.2u lib -- will let you know, as soon as I complete this test
checking the SSLIOHandler 1.1.x link..
nighthawk2032
@nighthawk2032
I managed to run (compiled) apache and this delphi>Linux>Module using openssl 1.0.2u -- how ever it responded the same. Which probably means that even if we'd be at a stage where Indy support 1.1.1 it won't help... I've installed wireshark and about to snoop the handshake.. if you have additional ideas, I'd be happy to test them
Askarali Azimov
@askarali82
Hello!
Is there exact information about which version of SSL DLL's we should use for particular version of Indy?
For example, I am using Indy 10.6.0.5167. What version of SSL DLL's should I download from here:
indy.fulgan.com/SSL
Remy Lebeau
@rlebeau
@askarali82 specific versions of Indy do not require specific versions of OpenSSL. Since you are using an old version of Indy (the current version is 10.6.2.x), just use the latest 1.0.2u of OpenSSL. Also, the Fulgan mirror is retired, the DLLs are now hosted on GitHub.
Askarali Azimov
@askarali82
@rlebeau Thank you. I will try.
Askarali Azimov
@askarali82
Hello @rlebeau.
Our C++ Builder application is throwing two errors related to SSL DLL's.
One is "Could not load SSL library" error.
This one is being thrown upon connecting to SMTP server.
The other error is "The ordinal 4163 could not be located in the dynamic link library {PATH}\ssleay32.dll."
Are these errors related?
The application and DLL's are located in the same directory.
Indy version is 10.6.0.5167.
Please let us know your thoughts.
Remy Lebeau
@rlebeau
@askarali82 which version of the DLLs are you using? More importantly, why are you using such an old version of Indy? 10.6.0 is almost 8 years old. The current version is 10.6.2.
Askarali Azimov
@askarali82
@rlebeau DLL's version is 1.0.2u. The application is old, written in XE2 years ago.
Remy Lebeau
@rlebeau
@askarali82 OpenSSL DLLs that are known to work with Indy are available at https://github.com/IndySockets/OpenSSL-Binaries. I strongly suggest you upgrade to the latest Indy 10.6.2 from https://github.com/IndySockets/Indy. It still supports XE2. There have been a lot of changes to Indy over the past 8 years, including for OpenSSL support. For instance, 10.6.0 did not support SNI, which many TLS 1.2 servers require.
Askarali Azimov
@askarali82
@rlebeau Thank you. I will do.
Javier Blanco Reliegos
@javier_hemadev_gitlab

Hello.

I want to do a very simple application. It is an http server that receives ajax requests.

The project is very easy, just a TIdHTTPServer that receives a post request with two parameters.

If I use Internet Explorer 11, it is working fine, but with Chrome and Edge I have the problem with the cors policy (preflight).

The message is the following:

Access to XMLHttpRequest at 'http://localhost/' from origin 'http://localhost:8080' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

How can I solve this?

I've seen that the CommandOther event is triggered. If I put

AResponseInfo.CustomHeaders.AddValue('Access-Control-Allow-Origin','*');
AResponseInfo.HeaderHasBeenWritten := true;

I don't get the same error, but instead of it I get

POST http://localhost/ net::ERR_EMPTY_RESPONSE

Any ideas?

Thank you

The ARequestInfo.Command is "OPTIONS"
Remy Lebeau
@rlebeau
@javier_hemadev_gitlab GET, POST and HEAD requests trigger the OnCommandGet event, everything else triggers the OnCommandOther event. CORS Preflight uses OPTIONS requests. But either way, yes you can use AResponseInfo.CustomHeaders to send additional headers not handled by other AResponseInfo properties. However, don't set AResponseInfo.HeaderHasBeenWritten := true; unless you have already sent a response to the client manually, otherwise that assignment will actually prevent TIdHTTPServer from sending its own response to the client. That would explain the "empty response" error. HeaderHasBeenWritten refers to "written to client", not "written to AResponseInfo".
nighthawk2032
@nighthawk2032
http://ww2.indyproject.org/downloads isn't accessible... where can I download the help files from?
Remy Lebeau
@rlebeau
@nighthawk2032 I had a recent discussion about that here: https://atozed.com/forums/thread-2375.html There is an Archive.org copy that has some working download links. We are still exploring options to restore the files on the Indy website.
Javier Blanco Reliegos
@javier_hemadev_gitlab
@rlebeau Thanks for your response. The other day i found something.
I was making the call with prototype-1.7.3. In this case, an OPTIONS call is made and CommandOther is triggered. If I put in that event the line AResponseInfo.CustomHeaders.AddValue('Access-Control-Allow-Origin', ''); it does not work. I keep getting the problem with CORS.
Just for testing, I changed the prototype call and did it with jQuery. In this case, the CommandOther event is not triggered, CommandGet is triggered directly. If I put the instruction AResponseInfo.CustomHeaders.AddValue('Access-Control-Allow-Origin', '
'); here, now it works. The following error appears three times in the browser console: net :: ERR_ABORTED 404, but as I said, it does work.
Remy Lebeau
@rlebeau
@javier_hemadev_gitlab I can't answer that without seeing the actual raw requests. But the CORS spec is very specific that CORS preflight uses OPTIONS only, so maybe your JQuery is not actually using CORS correctly, or at least not using prefetch?
Joshua Garcia
@jgarcia2397
Hi, does anyone know where I can find documentation for Indy? None of the links on their site work
nighthawk2032
@nighthawk2032
@jgarcia2397 as @rlebeau noted above you can find more information about the help files here https://atozed.com/forums/thread-2375.html
nighthawk2032
@nighthawk2032
I am running a 'TIdCustomTCPServer' on Linux (compiled by Delphi of course) -- after about 2+~ hours it seems to loose listening, and do not answer incoming connections... is there a timeout property somewhere? except for 'TerminateWaitTimeout' property I couldn't find anything related to that (no exception is raised on the server or client side)
nighthawk2032
@nighthawk2032
using this websocket server start https://github.com/staspiter/delphi-websocket
And managed to find out my exact problem (I complained above). Got different browser clients connected to a 'chat page' -- everything works fine.
Until a mobile client disconnects (wifi) from the server -- and it is back it reconnects properly -- but after that everything stuck.
WebSocket Server does not get the disconnection (instance) of this client, nonetheless it does connect it back again... but then it is probably lost in a broadcast loop.
What is the best way making sure that the Server's Contexts connections and IOHandler are properly working, and remove those that do not...
    List := FServer.Contexts.LockList;
    for i := 0 to List.Count-1 do
      (TWebSocketIOHandlerHelper(TIdContext(List[i]).Connection.IOHandler)).WriteString(msg);
    FServer.Contexts.UnlockList;
nighthawk2032
@nighthawk2032
Added a condition on this loop that skips the none active iohandler (when I turn off the wifi on the mobile) -- this validated my assumption, that what halt this loop is trying to send the msgstring to dead socket... Any ideas, what to do here?
nighthawk2032
@nighthawk2032

@rlebeau Following what you described on https://stackoverflow.com/questions/40374396/how-do-i-disconnect-inactive-clients-with-tidtcpserver
Compilation under Delphi/Linux. Using a TIdCustomTCPServer -- specified this on the .OnConnect event:

AContext.Binding.SetSockOpt(Id_SOL_SOCKET, Id_SO_SNDTIMEO, 1000);

Result with this: EIdSocketError: Socket Error # 22 - Invalid argument

Remy Lebeau
@rlebeau
@nighthawk2032 there is no listen/accept timeout, accepts are blocking until a client arrives or the server is shutdown. You are not supposed to manage the contexts youself, the server handles that. Contexts are removed when connections are closed. If a client does not close its connection gracefully, it can take awhile for a dead connection to be detected and reported by the OS. All you can really do in that case is use read/write timeouts, or keepalives/ping-pongs, closing connections that are deemed timeout/unresponsive.
@nighthawk2032 on Linux, SO_SNDTIMEO requires a pointer to a timeval structure, not an integer like on Windows. Binding.SetSockOpt() doesn't let you pass in a pointer, though. You will have to call the overloaded GBSDStack.SetSocketOption() that takes a const parameter and an integer (ie: var tv: timeval; ... GBDSStack.SetSocketOption(AContext.Binding.Handle, Id_SOL_SOCKET, Id_SO_SNDTIMEO, tv, sizeof(tv));), or call the underlying platform's socket API setsockopt() function directly.
nighthawk2032
@nighthawk2032
thanks @rlebeau , checking
Askarali Azimov
@askarali82
Hello @rlebeau. Our app is client-server app (two exe's). They were written in C++ Builder 2007 and use Indy 9 for communication. We also have one DLL that is loaded by both of the exe's. This DLL (mailer) is to send emails from both of the apps. This DLL uses latest version of Indy (10.6.2). When the server part sends emails, sometimes "The ordinal 4163 could not be located in the dynamic link library {PATH}\ssleay32.dll" error is being thrown.
Do you have any thought?