]> git.ipfire.org Git - thirdparty/curl.git/commit
schannel: fix hang on unexpected server close
authorJay Satiro <raysatiro@yahoo.com>
Fri, 9 Feb 2024 08:41:30 +0000 (03:41 -0500)
committerJay Satiro <raysatiro@yahoo.com>
Tue, 13 Feb 2024 08:45:21 +0000 (03:45 -0500)
commit24d6c2889f15f5141ff8d37b59f9099e8aae0f38
tree6507d04be335f3b3cc1b987c30fce9128a5db5a0
parented596eb40909d8df89f5849551cc4fcd468e08ca
schannel: fix hang on unexpected server close

- Treat TLS connection close (either due to a close_notify from the
  server or just closed due to receiving 0) as pending data.

This is because in some cases schannel_recv knows the connection is
closed but has to return actual pending data so it can't return 0 or an
error to indicate no more data. In this case schannel_recv must be
called again, which only happens if readwrite_data sees that there is
still pending data.

Prior to this change if the total size of the body that libcurl expected
to receive from the server was unknown then it was possible under some
network conditions that libcurl would hang waiting to receive more data,
when in fact a close_notify alert indicating no more data would be sent
was already processed.

Fixes https://github.com/curl/curl/issues/12894
Closes https://github.com/curl/curl/pull/12910
lib/vtls/schannel.c