[curl/curl] b24959: ssl: read pending close notify alert before closin...

Michael Kaufmann <[email protected]> Tue, 01 Jun 2021 00:41:39 -0700
Newsgroups gmane.comp.web.curl.cvs
Message-ID <curl/curl/push/refs/heads/master/[email protected]>
  Branch: refs/heads/master
  Home:   https://github.com/curl/curl
  Commit: b249592d29ae0a2b3e8e07fdbc01f33b5a5b8420
      https://github.com/curl/curl/commit/b249592d29ae0a2b3e8e07fdbc01f33b5a5b8420
  Author: Michael Kaufmann <[email protected]>
  Date:   2021-06-01 (Tue, 01 Jun 2021)

  Changed paths:
    M lib/vtls/gtls.c
    M lib/vtls/mbedtls.c
    M lib/vtls/nss.c
    M lib/vtls/openssl.c
    M lib/vtls/wolfssl.c

  Log Message:
  -----------
  ssl: read pending close notify alert before closing the connection

This avoids a TCP reset (RST) if the server initiates a connection
shutdown by sending an SSL close notify alert and then closes the TCP
connection.

For SSL connections, usually the server announces that it will close the
connection with an SSL close notify alert. curl should read this alert.
If curl does not read this alert and just closes the connection, some
operating systems close the TCP connection with an RST flag.

See RFC 1122, section 4.2.2.13

If curl reads the close notify alert, the TCP connection is closed
normally with a FIN flag.

The new code is similar to existing code in the "SSL shutdown" function:
try to read an alert (non-blocking), and ignore any read errors.

Closes #7095


_______________________________________________
curl-commits mailing list
[email protected]
https://cool.haxx.se/cgi-bin/mailman/listinfo/curl-commits