cesanta / mongoose

Embedded Web Server
https://mongoose.ws
Other
11.08k stars 2.72k forks source link

HTTPS client over builtin TCP/IP fails unit tests, passes with no optimization #2838

Open scaprile opened 3 months ago

scaprile commented 3 months ago

Discussed in https://github.com/cesanta/mongoose/discussions/2837

Confirmed no Client Hello

scaprile commented 3 months ago

Client Hello fixed in #2842

scaprile commented 3 months ago

The most noticeable case is with built-in TLS. Seems to work OK with MbedTLS The very same test code passes with sockets on Linux, and with -O0. Tried disabling optimization only for test code and still fails, so it looks like a library bug. However, optimization seems to hide a TCP-related story.

Following capture file shows 4 failures in a row, 1 success, 1 failure, 1 success: capture.zip All failures have the disconnect notification piggybacked to the server response First success: disconnect notification is on a separate frame Second success: Wireshark shows a TCP segment reassembled from two frames, it is not clear where the disconnect notification starts.

Following capture file shows 5 successful connections in a row (built with -O0): capture2.zip In all cases, disconnect notification is on a separate frame