wininet

How to get a response message of LIST command (from CFTPConnection)

孤街醉人 提交于 2019-12-01 13:09:11
How can I get a response of LIST command executed with CFTPConnection::Command() . I can get the directory listing. But not free space size information. Windows IIS FTP server gives free space as response of LIST command: How to check free space in a FTP Server? It does not look like that the MFC CFTPConnection class has an API to access the response message of the command executed. Though as the class is just a wrapper around Win32 Wininet functions, you can use InternetGetLastResponseInfo function to retrieve the response right after calling CFTPConnection::Command . Retrieves the last error

Manually validate server certificate in WinINet

喜夏-厌秋 提交于 2019-12-01 10:31:01
I'm trying to implement manual self-signed SSL certificate validation to a WinINet client. I tried to approach it by calling InternetQueryOption with INTERNET_OPTION_SECURITY_CERTIFICATE or INTERNET_OPTION_SECURITY_CERTIFICATE_STRUCT parameters, but both return some internal interpretation of server's certificate, none allows accessing raw certificate public key or at least thumbprimnt. How am I supposed to validate certificate?... m_skipper Additionaly to previous answer. If you want to manualy check certificates with untrusted root(self signed for example), you need to 1) Set flags to ignore

Manually validate server certificate in WinINet

泄露秘密 提交于 2019-12-01 09:08:08
问题 I'm trying to implement manual self-signed SSL certificate validation to a WinINet client. I tried to approach it by calling InternetQueryOption with INTERNET_OPTION_SECURITY_CERTIFICATE or INTERNET_OPTION_SECURITY_CERTIFICATE_STRUCT parameters, but both return some internal interpretation of server's certificate, none allows accessing raw certificate public key or at least thumbprimnt. How am I supposed to validate certificate?... 回答1: Additionaly to previous answer. If you want to manualy

Unable to query proxy “Automatically Detect Settings” on windows 7

故事扮演 提交于 2019-11-30 23:57:18
I am trying to capture proxy setting ("Automatically Detect Settings"). My code works on XP and Vista. But it is NOT working on Windows 7 Please see the details of target platform Windows 7 Enterprise, IE 8.0.7600.16385, Wininet.dll 8.0.7600.16535 Please see the code snippet INTERNET_PER_CONN_OPTION_LIST List; INTERNET_PER_CONN_OPTION Option[1]; unsigned long nSize = sizeof(INTERNET_PER_CONN_OPTION_LIST); Option[0].dwOption = INTERNET_PER_CONN_FLAGS; List.dwSize = sizeof(INTERNET_PER_CONN_OPTION_LIST); List.pszConnection = NULL; List.dwOptionCount = 1; List.dwOptionError = 0; List.pOptions =

How to Prevent dialog (Basic Authentication prompt) during call of Webservice

笑着哭i 提交于 2019-11-30 14:11:29
问题 In a delphi program (running as a service) i need to call some webservices. The calls works fine if basic Authentications is not requerired. The calls also works fine if Basic Authentication is requerired and username/password is provided (in BeforePost) using: InternetSetOption(Data, INTERNET_OPTION_USERNAME,... InternetSetOption(Data, INTERNET_OPTION_PASSWORD,... But if Basic Authentication is Requeried, and username/password is not provided, the program brings up af prompt for the username

C++/WinInet Change Proxy Settings Windows 7

邮差的信 提交于 2019-11-30 13:30:33
问题 [Disclaimer: this is a Windows 7 specific issue as far as I can tell] I've got a block of code that changes the proxy settings in the Windows registry, then proceeds to call the WinInet API with the following: InternetSetOption(NULL, INTERNET_OPTION_SETTINGS_CHANGED, NULL, 0); InternetSetOption(NULL, INTERNET_OPTION_REFRESH , NULL, 0); This is completely fine in XP and Vista, however in Windows 7 something has apparently changed, and for some reason the previous registry keys get injected

Saving a webpage to disk using C++

浪子不回头ぞ 提交于 2019-11-29 17:55:08
I've managed to download a "file" from the internet with the help of wininet library, but I can't seem to save a "webpage" i.e. something I can edit later on with a text editor or with ifstream . In this case, what are the tools I should resort to? Can wininet save a webpage to disk? Should I consider cURL (though I haven't managed to download regular files due to lack of documentation of cURL )? Do I need to learn what's called socket programming ? NB: I'm on Windows, using MinGW but can switch to MSVC if necessary, I'm looking for source code in the webpage, eventually I'm after the text in

Client authentication (certificat + private key) using WinInet

点点圈 提交于 2019-11-29 15:51:56
This is an evolution of my previous question , which was about WinHttp. I hope this is the right way to do this... I'm trying to communicate in https with a server using WinInet (from the Win32 API). Here is a very minimalist code : HINTERNET ses = InternetOpen("test",INTERNET_OPEN_TYPE_DIRECT,NULL,NULL,0) ; HINTERNET con = InternetOpenUrl( ses,"https://stackoverflow.com",NULL,0,0,0 ) ; DWORD read ; char str [3000] ; InternetReadFile( con,reinterpret_cast<void*>( str ),sizeof( str )-1,&read ) ; str[read] = 0 ; cout << &str[0] ; InternetCloseHandle( con ) ; InternetCloseHandle( ses ) ; As long

How to clear MSIE/WinInet cache programmatically?

…衆ロ難τιáo~ 提交于 2019-11-29 15:25:33
I'm trying to clear out the WinInet cache using Win32 API - by invalidating the cache entries, or deleting them (doesn't matter). I can't find any way to do this for the whole cache (other than iterating over each entry - example in C# , another in VB ) - is this even possible? I'm fairly certain doing the FindFirst/FindNextUrlCacheEntry() then DeleteUrlCacheEntry() is the only way to make sure it works across all versions of IE. Alternatively you can use FindFirst/ FindNextUrlCacheGroup() and DeleteUrlCacheGroup() with "CACHEGROUP_FLAG_FLUSHURL_ONDELETE" but you have to make sure you only

Dev C++ Wininet Upload file using HTTP

孤者浪人 提交于 2019-11-29 08:42:48
I want to upload "C:\test.txt" to webserver, when I am running program, file is not uploading and I am not getting any error. the complete C++ code can be find here and php code on webserver can be find here: " http://student114.110mb.com/upload.txt " or " http://student114.110mb.com/upload.php " kindly help me where I am doing wrong #include <windows.h> #include <wininet.h> #include <tchar.h> #include <iostream> #pragma comment(lib,"wininet.lib") using namespace std; int main() { static TCHAR frmdata[] = "-----------------------------7d82751e2bc0858\nContent-Disposition: form-data; name=\