Delay When Falling Back from HTTPS to HTTP During XProtect MIP SDK Login

Hi,

We are implementing a function that uses the MIP SDK to log in to XProtect from our tracking management device (10.xxx.yyy.12) to the video management server (10.zzz.www.71), and would like to confirm the time required for the login process.

[Observed Behavior]

sddownload.zip (2.7 KB)

When logging in to XProtect using the MIP SDK, the time required for the process to complete is inconsistent. In some cases, it takes approximately 12 seconds on average, while in other cases it completes in approximately 0.8 seconds.

Please note that no certificate for HTTPS communication is configured in our environment. Therefore, the HTTPS connection fails and the login completes by falling back to HTTP. We understand this as a known limitation.

[Investigation]

We collected logs from the tracking management device and packet captures from the video management server, and compared the breakdown of the processing time.

Log for a slow case (approximately 12 seconds)

2026/10/22 11:02:05.038 [Start]Login

2026/10/22 11:02:17.788 [End]Login(return:True)

Log for a fast case (approximately 0.8 seconds)

2026/10/22 11:38:09.206 [Start]Login

2026/10/22 11:38:09.992 [End]Login(return:True)

Based on the packet captures, we divided the processing time into the following phases and compared the two cases.

Phase Slow case (approximately 12 seconds) Fast case (approximately 0.8 seconds)

① TCP connection (443) to receipt of TLS Server Hello

Approximately 34 ms

Approximately 23 ms

② After receipt of TLS Server Hello until the client initiates the next action

Approximately 4.97 seconds (no response)

Approximately 59 ms

③ HTTPS socket close processing

Client sends FIN → server returns ACK only

Server immediately sends RST

④ After HTTPS close until fallback to HTTP (port 80) begins

Approximately 7.03 seconds (no response)

Approximately 8 ms

⑤ Communication for token acquisition, etc. over HTTP (port 80)

Approximately 0.83 seconds

Approximately 0.66 seconds

Total

Approximately 12.75 seconds

Approximately 0.79 seconds

As shown above, most of the difference (②: approximately 4.9 seconds and ④: approximately 7.0 seconds) is caused by periods during which there is no response from the client (MIP SDK) after the TLS handshake has completed.

In the fast case, immediately after receiving the TLS Server Hello, the client sends Application Data (presumed to be a TLS Alert related to a certificate validation error, etc.), and the server immediately returns an RST. We believe this allows the client to fall back to HTTP immediately without waiting.

In contrast, in the slow case, the client does not respond for approximately five seconds after receiving the TLS Server Hello. Furthermore, even after the socket is closed, it takes approximately seven seconds before the client initiates the next connection (switching to HTTP).

[Question ①: Client-Side (MIP SDK) Wait / Timeout Behavior]

When certificate validation fails after the TLS handshake has completed, does the client have internal timeout processing such as the following?

Wait time (timeout value) after receiving the TLS Server Hello until the client determines that certificate validation has failed

Retry interval / wait time between giving up on the HTTPS connection and falling back to HTTP

If these timeout values are configurable, we would like to confirm the recommended values and how they can be changed.

[Question ②: Difference in Server-Side TLS Termination Behavior]

Although the certificate is not configured in either case, we have observed the following differences in the server-side connection termination behavior after the TLS handshake.

Slow case:

The server returns only an ACK in response to the client’s FIN (no RST is sent)

Fast case:

The server immediately sends an RST after the certificate validation error is detected

Could you please advise whether there are any known factors that could cause this difference in behavior, such as the implementation of server-side TLS termination, the OS/socket state, or system load?

Also, if there is any configuration or implementation that would allow the server to consistently return an RST at an early stage, we believe this could significantly reduce the client-side wait time. Please advise if there is any way to achieve this.

[Environment]

XProtect version: XProtect Corporate 2025R2

MIP SDK version: MIP-SDK2025R2

OS: Windows 11 LTSC

Language / Framework: C# / .NET Framework 4.8

[Reproducibility]

The processing time (approximately 12 seconds / approximately 0.8 seconds) occurs randomly, but the fast case occurs approximately once in every 10 attempts.

Attachments:

映像ビューア起動時間調査_抜粋.csv (packet capture for the slow case)

映像ビューア起動時間調査2.csv (packet capture for the fast case)

We have attached the logs for your review as well.

Thanks,
Best Regards,
NVS Technical Support

For completeness we would like to ask you to do a trace of the login using these instructions:

Enable MIP log tracing for login in a standalone MIP SDK based application (how-to)

KB article content:

If you experience login issues in a standalone MIP SDK-based application, you can enable extended logging by following these steps:

  1. Create a MIPSettings.xml file using a plain text editor and place it in the folder containing your application’s .exe file.
  2. Change the LoginTrace value to True.
  3. Start your application and attempt to log in.
  4. The tracing output will be written to the MIP SDK log folder:C:\ProgramData\Milestone\MIPSDK\

The MIPSettings.xml file should have the following content, with LoginTrace enabled:

<?xml version="1.0" encoding="utf-8" ?>
<Settings>
  <TraceFunctionCalls>False</TraceFunctionCalls>
  <TraceMessageCommunication>False</TraceMessageCommunication>
  <TraceSendDetails>False</TraceSendDetails>
  <TracePlaybackDetails>False</TracePlaybackDetails>
  <TraceItemConfigurationCache>False</TraceItemConfigurationCache>
  <TraceConfigurationApi>False</TraceConfigurationApi>
  <LoginTrace>True</LoginTrace>
</Settings>

Note: Alternatively, you can download the MIPSettings.xml file below. Unzip the XML file first, make the necessary adjustments, and place it in the folder containing your application’s .exe file.

Download MIPSettings.zip

I noticed that you’re also the author of this topic: How to Disable HTTPS Processing During Login in the SDK.

Can you confirm whether the method described in the answer avoids the HTTPS-related delay and therefore reduces the overall login time?

By changing the setting you advised us of in Case 14789, we have confirmed that we can connect via HTTP and eliminate the time required for login. However, what we would like to ask about this time is the server-side connection termination behavior after the TLS handshake described in Question 2.

Could you please advise on any possible factors that could cause this behavior?

[Question 2: Differences in Server-Side TLS Termination Behavior]

Even in environments where no certificate is configured, we have observed differences in the server-side connection termination behavior after the TLS handshake, as follows:

Slow case: The server responds only with an ACK to the client’s FIN and does not send an RST.

Fast case: After detecting a certificate validation error, the server immediately sends an RST.

Could you please advise on any possible factors that could cause this difference in behavior, such as the server-side TLS termination implementation, OS/socket state, or system load?

If possible, we would appreciate your response by this weekend—specifically, by Friday, November 30, Japan Standard Time.

As a quick workaround, try lowering VideoOS.Platform.EnvironmentOptions.ConnectionCheckTimeout to 1 second. This should help reduce the login time. The login will likely still be slower than the fast login, but the wait should be shorter.

See the MIP SDK documentation for ConnectionCheckTimeout.

I suspect this may be a more general issue rather than something specific to a MIP SDK-based client. One way to check is to compare the behavior with the Smart Client. If you see the same slow login there, please create a technical support case through the Milestone Support Portal for further investigation.