mirror of
https://github.com/Adaptix-Framework/AdaptixC2
synced 2026-06-08 10:20:39 +00:00
Merge pull request #97 from Xre0uS/fix-connection-handles
Properly close connection handles on WinINet errors
This commit is contained in:
@@ -229,19 +229,17 @@ void ConnectorHTTP::SendData(BYTE* data, ULONG data_size)
|
||||
|
||||
attempt++;
|
||||
if (!connected) {
|
||||
if ( dwError == ERROR_INTERNET_CANNOT_CONNECT || dwError == ERROR_INTERNET_TIMEOUT ) {
|
||||
if (this->hConnect) {
|
||||
this->functions->InternetCloseHandle(this->hConnect);
|
||||
this->hConnect = NULL;
|
||||
}
|
||||
if (this->hInternet) {
|
||||
this->functions->InternetCloseHandle(this->hInternet);
|
||||
this->hInternet = NULL;
|
||||
}
|
||||
|
||||
this->functions->InternetSetOptionA(NULL, INTERNET_OPTION_SETTINGS_CHANGED, NULL, 0);
|
||||
this->functions->InternetSetOptionA(NULL, INTERNET_OPTION_REFRESH, NULL, 0);
|
||||
if (this->hConnect) {
|
||||
this->functions->InternetCloseHandle(this->hConnect);
|
||||
this->hConnect = NULL;
|
||||
}
|
||||
if (this->hInternet) {
|
||||
this->functions->InternetCloseHandle(this->hInternet);
|
||||
this->hInternet = NULL;
|
||||
}
|
||||
|
||||
this->functions->InternetSetOptionA(NULL, INTERNET_OPTION_SETTINGS_CHANGED, NULL, 0);
|
||||
this->functions->InternetSetOptionA(NULL, INTERNET_OPTION_REFRESH, NULL, 0);
|
||||
|
||||
this->server_index = (this->server_index + 1) % this->server_count;
|
||||
}
|
||||
@@ -283,4 +281,4 @@ void ConnectorHTTP::CloseConnector()
|
||||
|
||||
this->functions->InternetCloseHandle(this->hInternet);
|
||||
this->functions->InternetCloseHandle(this->hConnect);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user