winhttp

WinHTTP Request data in unicode?

萝らか妹 提交于 2020-01-06 15:09:52
问题 I'm trying to read a web page via WinHTTP: bool WinHTTPClass::QueryResponseData(std::string &query_data) { // Read response DWORD dwSize, dwDownloaded = 0; do { // Check for available data. if( !WinHttpQueryDataAvailable( hRequest, &dwSize ) ) { cout << "Error querying data : " << GetLastError() << endl; return false; } // Allocate space for the buffer. char* pszOutBuffer = new char[dwSize+1]; if( !pszOutBuffer ) { cout << "Out of memory" << endl; dwSize=0; } else { // Read the data.

python win32com how to set winhttp option value

大憨熊 提交于 2020-01-02 13:08:28
问题 from win32com.client import Dispatch winhttp = Dispatch('winhttp.winhttprequest.5.1') print winhttp.Option(6) #True winhttp.Option(6) = False #SyntaxError <----------------how to set Option(6) to false print winhttp.Option(6) winhttp.Open('GET', 'http://google.com', False) winhttp.Send() print winhttp.responsetext =========================================== output: invalid syntax: winhttp.py, line 13, pos 11 File "c:\Users\***\Desktop\winhttp.py", line 13, in ? set winhttp.Option(6) = False

vb6 winhhtp: Error Occurred in the Secure Channel Support

三世轮回 提交于 2020-01-02 10:01:34
问题 I wrote a VB6 program which uses winhttp.dll to send and receive messages to/from a remote server. It has been working fine from various operating systems: Windows 2000, WinXP, Win7, Win8. Recently the server provider informed me that they will " phase out support of SHA-1 security certificates " and i need to " check that the thumbprint is aligned to SHA-2 new SSL cert. ". What is happening now is that when my program runs on WinXP,7,8 - it's still OK. But when running on Windows 2000, when

HttpAddUrl on localhost fails for non-admin users

我只是一个虾纸丫 提交于 2020-01-01 18:34:45
问题 Using the Windows HTTP API I'm running a HTTP file server on localhost. This involves calling HttpAddUrl(hRequestQueue, L"http://localhost:80/", NULL) . This fails with ERROR_ACCESS_DENIED unless the user runs the application as administrator. I need this functionality for users who don't have admin privileges. (What's wrong with a user running a localhost server anyway? It's just for the user themselves.) I found a hotfix for Vista and XP which seems aimed at solving this, but there's

HttpAddUrl on localhost fails for non-admin users

ぐ巨炮叔叔 提交于 2020-01-01 18:32:09
问题 Using the Windows HTTP API I'm running a HTTP file server on localhost. This involves calling HttpAddUrl(hRequestQueue, L"http://localhost:80/", NULL) . This fails with ERROR_ACCESS_DENIED unless the user runs the application as administrator. I need this functionality for users who don't have admin privileges. (What's wrong with a user running a localhost server anyway? It's just for the user themselves.) I found a hotfix for Vista and XP which seems aimed at solving this, but there's

VBA WinHTTP to download file from password proteced https website

假如想象 提交于 2019-12-28 03:03:05
问题 I'm trying to save a file from https password protected site using WinHTTP. Here's the code: Sub SaveFileFromURL() Dim FileNum As Long Dim FileData() As Byte Dim WHTTP As Object fileUrl = "https://www.website.com/dir1/dir2/file.xls" filePath = "C:\myfile.xls" myuser = "username" mypass = "password" Set WHTTP = CreateObject("WinHTTP.WinHTTPrequest.5.1") WHTTP.Open "GET", fileUrl, False WHTTP.SetCredentials myuser, mypass, HTTPREQUEST_SETCREDENTIALS_FOR_SERVER WHTTP.Send FileData = WHTTP

How do I get the request headers of a WINHTTP request?

落花浮王杯 提交于 2019-12-24 06:29:11
问题 I need to be able to log the outgoing request, which I am sending using winhttp. Everything else is easy to get (status code, content, response headers, etc) but there appears to be absolutely no way to see what winhttp is actually sending in the request headers. I need to log the request headers because it contains a cookie from the login's set-cookie, but which is being rejected for unknown reasons from the application, whereas the same urls succeed in a browser. I had to convert an older

How to download file from secure website with WinHTTPRequest.5.1

可紊 提交于 2019-12-23 02:58:12
问题 I'm trying to download files(PDFs) silently from a website with VBA. So far I login without issue entering UserName & Password on the initial screen, navigate to the reports page within the site, get my list of files successfully in a table. I get the URL of the file in question without issue. Here's where I hit a wall. I do download a file but get a security warning when i open it that I must be logged in to view it. I can simulate this warning by pasting a URL into any browser when I'm not

WinHttp doesn't work when hostname doesn't contains www. (error 12029)

核能气质少年 提交于 2019-12-22 14:04:55
问题 I am testing this winhttp example from http://msdn.microsoft.com/en-us/library/aa384270%28v=vs.85%29.aspx DWORD dwSize = 0; DWORD dwDownloaded = 0; LPSTR pszOutBuffer; BOOL bResults = FALSE; HINTERNET hSession = NULL, hConnect = NULL, hRequest = NULL; // Use WinHttpOpen to obtain a session handle. hSession = WinHttpOpen( L"WinHTTP Example/1.0", WINHTTP_ACCESS_TYPE_DEFAULT_PROXY, WINHTTP_NO_PROXY_NAME, WINHTTP_NO_PROXY_BYPASS, 0 ); // Specify an HTTP server. if( hSession ) hConnect =

How to use “WinHttp.WinHttpRequest.5.1” asynchronously?

旧巷老猫 提交于 2019-12-22 09:12:14
问题 The code: var WinHttpReq: OleVariant; procedure TForm1.Button1Click(Sender: TObject); begin WinHttpReq := CreateOleObject('WinHttp.WinHttpRequest.5.1'); WinHttpReq.Open('GET', 'http://stackoverflow.com', TRUE); // asynchronously WinHttpReq.setRequestHeader('User-Agent', 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0'); WinHttpReq.Send(); // HOW to set a callback procedure here and get the response? end; Note: I do not want to import mshttp.dll and use TLB. I want to use it via late