Webrequest switches to https after 2 minutes.

 

Metatrader 5 build 5833

Webrequest is used to send requests to LM studio. I have no problems on Windows 11. But the client on Windows 10 reports such a problem:

I did a few more timing tests and can now say that the problem with the HTTP/HTTPs POSTs is that HTTPS is used if a job is after 2 minutes of the prior POST; and HTTP is used if the job is within 2 minutes of the last POST. No apparent relationship to the timeout parameter. Repeatable.

If the request comes via Https, LM studio does not accept it.


There is one answer. It may complicate things, but it doesn't solve anything.

  - The EA always sends the local request as http://127.0.0.1 — there is no HTTPS for the local server  anywhere in the code, so it cannot switch on its own. This is done by the Windows WinINet stack.

  - The "2 minutes" = the idle timeout of the WinINet keep-alive connection pool. The TLS context from  the previous HTTPS request "leaks" onto the new http handle.


p.s. The timeout is still not working in Webrequest. There is a hard 120 seconds.