wininet

How does wininet handle cookies

六月ゝ 毕业季﹏ 提交于 2019-12-13 20:24:18
问题 I have a .NET client application that needs to communicate with a server using two distinct user credentials. Lets say that the application runs two threads. When start running, every thread sends the user & password to authenticate and the server in return stores a cookie on the http session. The subsequent calls send the authentication cookie and not the user credentials. We have two cookies for the same process. How does wininet "knows" to send the appropriate cookie for each thread? Does

Delphi - XE2 code to Delphi7 needed. Using wininet to download a file

╄→尐↘猪︶ㄣ 提交于 2019-12-13 19:23:17
问题 Note: I only want to use wininet, not urlmon-urldownloadtofile. Well, I have the following code which works perfectly in XE2 to download a file: procedure DownloadFile(URL: string; Path: string); const BLOCK_SIZE = 1024; var InetHandle: Pointer; URLHandle: Pointer; FileHandle: Cardinal; BytesRead: Cardinal; DownloadBuffer: Pointer; Buffer: array [1 .. BLOCK_SIZE] of byte; BytesWritten: Cardinal; begin InetHandle := InternetOpen(PWideChar(URL), 0, 0, 0, 0); URLHandle := InternetOpenUrl

How to fix this error: undefined reference to `__imp_InternetOpenA'

懵懂的女人 提交于 2019-12-13 18:59:24
问题 I want make C++ program where send .txt file with information to my PC. I surch so much in internet but cant find method that works. When I uusing Dev C++ give me this errors: ...: undefined reference to __imp_InternetOpenA' ...: undefined reference to __imp_InternetConnectA' ...: undefined reference to __imp_FtpPutFileA' ...: undefined reference to __imp_HttpOpenRequestA' Here are three examples where I find, but all return this error. <pre> #include <windows.h> #include <wininet.h> #include

WinInet::InternetSetOption(…) always returns 0 and GetLastError() returns 12018

让人想犯罪 __ 提交于 2019-12-13 17:04:57
问题 I am trying to set user name and password for proxy using InternetSetOption(...) method. However, it always returns zero and Last error is set to 12018. Below is my code snippet. #include "stdafx.h" #include <Wininet.h> int _tmain(int argc, _TCHAR* argv[]) { HINTERNET _session = ::InternetOpen(_T("TestProgram"), INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, NULL); LPCTSTR proxyUserName = L"username"; LPCTSTR proxyPassword = L"userpassword"; BOOL b = ::InternetSetOption(_session,INTERNET_OPTION

Access violation using FtpFindFirstFile unicode version in async mode

荒凉一梦 提交于 2019-12-13 04:38:40
问题 Let's say I have very simple little code sample which uses async WinInet: #include "stdafx.h" #include "WinInet.h" #pragma comment(lib, "wininet.lib") DWORD LatestResult = 0; HANDLE MayContinue = 0; VOID CALLBACK CallBack( __in HINTERNET hInternet, __in DWORD_PTR dwContext, __in DWORD dwInternetStatus, __in_bcount(dwStatusInformationLength) LPVOID lpvStatusInformation, __in DWORD dwStatusInformationLength ) { if (dwInternetStatus == INTERNET_STATUS_REQUEST_COMPLETE) { LatestResult = (

Problem with wininet C++

£可爱£侵袭症+ 提交于 2019-12-13 04:09:58
问题 Can anyone find problem in this function? My application makes several requests and if first request is using SSL, app crashes on some computers(on mine 4 computers + vmware it works ok without crash). Here is code char Buffer[1024]; DWORD dwRead; string data; string Request(string method, string host, string file, string headers, string post, bool debug, bool SSL) { HINTERNET hSession, hDownload, hRequest; DWORD flag; DWORD port; data.empty(); //SSL or not + flag :) if (SSL) { port =

HttpSendRequest blocking when more than two downloads are already in progress

早过忘川 提交于 2019-12-12 17:32:06
问题 In our program, a new thread is created each time an HTTP request needs to be made, and there can be several running simultaneously. The problem I am having is that if I've got two threads already running, where they are looping on reading from InternetReadFile() after having called HttpSendRequest() , any subsequent attempts to call HttpSendRequest() just hang on that call, so I end up with the previously mentioned two threads continuing to read from their connections just fine, but the

How to use the WinInet API from Java?

China☆狼群 提交于 2019-12-12 17:25:42
问题 According to this answer to an earlier question of mine, the WinInet Windows API is the correct way to read and write internet connection settings in Windows. How can I use this API from Java? I'd prefer a free, open-source solution. 回答1: There's always JNI and JNA, but if you don't already know C or C++ there'll be a learning curve involved, especially with JNI: JNI Reference, JNA Site 回答2: Over the last months I had to mix with my Java project some C, C++ and Win32 alternatives for native

Need help using Wininet Functions

依然范特西╮ 提交于 2019-12-12 04:55:18
问题 I am programming in C++ and I want to upload a file to my web server which i have already done using the following code: #include "stdafx.h" #include <windows.h> #include <wininet.h> #pragma comment(lib, "wininet") int _tmain(int argc, _TCHAR* argv[]) { HINTERNET hInternet; HINTERNET hFtp; hInternet = InternetOpen(NULL, INTERNET_OPEN_TYPE_DIRECT, NULL,NULL,0); hFtp = InternetConnect(hInternet, L"ftp.freetzi.com", INTERNET_DEFAULT_FTP_PORT, L"myuser.freetzi.com", "mypassword", INTERNET_SERVICE

how to send a zip file using wininet in my vc++ application

家住魔仙堡 提交于 2019-12-12 04:27:42
问题 I was able to send a txt file by having these 2 variables storing header... static TCHAR hdrs[] = "Content-Type: multipart/form-data; boundary=---------------------------7d82751e2bc0858"; sprintf(frmdata,"-----------------------------7d82751e2bc0858\r\nContent-Disposition: form-data; name=\"uploaded_file\";filename=\"%s\"\r\nContent-Type:application/octet-stream\r\n\r\n",temp_upload_data->file_name); I am adding txt file data to frmdata variable at its end.i am opening txt file in read mode.