diff options
author | Ian Hattendorf <ianh@axosoft.com> | 2021-03-01 16:26:58 -0700 |
---|---|---|
committer | Ian Hattendorf <ianh@axosoft.com> | 2021-03-01 17:40:30 -0700 |
commit | edffea1548d87cdb1c684792195166e7a1b36a4a (patch) | |
tree | 48c0f44e6bcad13de6bfddfa693fa540e686a91c /tests/graph/commit_graph.c | |
parent | 592a325229331f2e7f66cfca6b8ae2f653c57f35 (diff) | |
download | libgit2-edffea1548d87cdb1c684792195166e7a1b36a4a.tar.gz |
winhttp: skip certificate check if unable to send request
In some circumstances (e.g. when proxies are involved), winhttp will fail to reach the WINHTTP_CALLBACK_STATUS_SENDING_REQUEST phase. If this occurs, we'll error with ERROR_WINHTTP_INCORRECT_HANDLE_STATE when attempting to query the server certificate context (see https://docs.microsoft.com/en-us/windows/win32/api/winhttp/nf-winhttp-winhttpsendrequest#remarks).
To avoid this, verify that WinHttpSendRequest has reached the WINHTTP_CALLBACK_STATUS_SENDING_REQUEST phase before checking the certificate. Since we're using WinHTTP in synchronous mode, we know for sure that once WinHttpSendRequest returns we've either sent it successfully or not.
NOTE: WINHTTP_CALLBACK_STATUS_SENDING_REQUEST appears to be deprecated with no direct replacement. WINHTTP_CALLBACK_STATUS_SENDREQUEST_COMPLETE is only available in async mode, and there doesn't appear to be a method of querying this flag outside of the status callback.
Diffstat (limited to 'tests/graph/commit_graph.c')
0 files changed, 0 insertions, 0 deletions