Questions tagged [wininet]

The Windows Internet (WinINet) API enables Windows applications to interact with FTP, and HTTP protocols to access Internet resources.

The Windows Internet (WinINet) application programming interface (API) enables applications to interact with FTP, and HTTP protocols to access Internet resources. As standards evolve, these functions handle the changes in underlying protocols, enabling them to maintain consistent behavior.

559 questions
4
votes
3 answers

WinInet HttpQuery Info returning Invalid Status Codes

I am working on a program that needs to check the existence of a page before it loads (so nothing too exotic). Everything is working OK, but I cannot get HttpQueryInfo to return a valid status code for a page. The status code returned is:…
dymk
  • 807
  • 1
  • 9
  • 20
4
votes
4 answers

Is it safe to assume InternetCloseHandle() won't fail, thereby allowing cleaner code?

Here's a routine to do an HTTP request using WinINet and either return the fetched string or raise an exception: function Request(const pConnection: HINTERNET; const localpath: string): string; var Buffer: packed Array[1..5000] of Char; BytesRead:…
4
votes
3 answers

How to clear cookie through WinINet function?

Using WinINet InternetGetCookie and InternetSetCookie functions, it's pretty straightforward to get and set cookie inside the application which makes a web request through WinINet. However, I could not so far find a way to clear cookie. Calling…
Kei
  • 1,546
  • 1
  • 15
  • 25
4
votes
1 answer

Why would WinInet fail to authenticate automatically via Negotiate when connecting by FQDN, but succeed if connecting by IP?

Having a strange issue where WinInet is failing to authenticate using users current credentials if I connect to an internal service by name, but not if I connect by IP. In one of our environments, which sits in its own domain, DOM1, our client can…
bpeikes
  • 2,628
  • 5
  • 32
  • 63
4
votes
0 answers

Is Dot Net HttpClient Unexpectedly Caching Responses?

I'm attempting to write a curl-like tool that demonstrates the effect of various HTTP caching headers on dot net's HttpClient class. In my initial attempt I'm pointing the tool at one of my internal web services that does not specify any caching…
Larry Lustig
  • 46,058
  • 13
  • 95
  • 143
4
votes
1 answer

Simple function to read file from an URL to a string buffer ( C++ / MQL{4|5} using WinInet.dll )

I am looking for a simple function which is able to read a text or binary file from the internet into a string variable. It´s unbelievable that I could not find anything in the web, just low level descriptions of all the WinInet functions and…
Doerk
  • 71
  • 8
4
votes
5 answers

Why would InternetOpenURL report error 2 (the system cannot find the file specified)?

The internet access code in our product works perfectly for 99.99% of people. However, for a few of them, it just doesn't work at all. We've been adding some trace code to try and figure out what the problem is, and it it turns out that…
Colen
  • 12,368
  • 20
  • 72
  • 101
4
votes
3 answers

How to send a HTTP Post Request in Delphi 2010 using WinInet

I want to send a HTTP Post Request in Delphi 2010 using WinInet, but my script doesn't work ;/ It's my Delphi script: uses WinInet; procedure TForm1.Button1Click(Sender: TObject); var hNet,hURL,hRequest: HINTERNET; begin hNet :=…
noxwow
  • 103
  • 2
  • 2
  • 5
4
votes
1 answer

Socket remains in CLOSE_WAIT state

I am using Wininet to perform a check with my server when the application get started. The problem is that after calling CloseInternetHandle the socket state remains CLOSE_WAIT as seen on netstat, and the worst part is that it never changes it…
opc0de
  • 11,228
  • 13
  • 86
  • 183
4
votes
1 answer

HttpSendRequest blocks on SOAP call

I have trouble with Delphi XE2 app. Sometimes WinInet call to ASMX service blocks and never returns - user must terminate process from task manager to close app. To connect to ASMX service app uses service generated by WSDLImp tool. During its work,…
GothAr
  • 491
  • 4
  • 14
4
votes
1 answer

Why does GetErrorMessage return "wrong password", when the user name is wrong?

GetErrorMessage (from CInternetException) gives me the following: With the incorrect ftp server name: "ERROR! The server name or address could not be resolved" With the incorrect password: ERROR! The password was not allowed With the incorrect…
T.T.T.
  • 29,703
  • 45
  • 120
  • 161
4
votes
1 answer

Force Basic Authentication with HttpSendRequest?

Using InternetSetOption to set the username and password when connecting to a REST service. I notice that WinInet does not send the Authorization header when I call HttpSentRequest even though I called InternetSetOption first. Seems ridiculous that…
bpeikes
  • 2,628
  • 5
  • 32
  • 63
4
votes
2 answers

C++/WinInet Change Proxy Settings Windows 7

[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,…
Michael
  • 2,991
  • 1
  • 19
  • 26
4
votes
3 answers

How do I transfer a file using wininet that is readable by a php script?

I would like to transfer a text file to a webserver using wininet as if the file was being transferred using a web form that posts the file to the server. Based on answers I've received I've tried the following code: static TCHAR hdrs[] =…
Rob
  • 2,292
  • 7
  • 30
  • 33
4
votes
1 answer

How can I download a huge file via TIdHTTP?

I use this code to download small files: Var ms:TMemoryStream; begin ms:=TMemoryStream.Create; Idhttp1.get('http://mydomain.com/myfile.zip',ms); ms.SaveToFile('myfile.zip'); ms.Free; end; But file is saved in RAM before storing to disk,…
Red October
  • 487
  • 1
  • 8
  • 27
1 2
3
37 38