Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

making https request with authentication 1

Status
Not open for further replies.

davidchardonnet

Programmer
Mar 21, 2001
167
FR
Hello,

I want to make a https request on the web on a authenticated web site. For http request I usually use UrlDownloadToFile wich works well. But here with https, it never works. The only way it works is by opening an Internet Explorer first, opening the https web site where i want to make the request, and my Delphi app seems to have the right to download. If IE is closed, my Delphi app cannot access....
I want my delphi app to work all alone, without IE.
Can you help me?

Thank you
 
This is how I do it. I use the Indy components. Drop a TIdHTTP component on your form. Then a IdSSLIOHandlerSocketOpenSSL component. Link TIdHTTP.IOHandler to the IdSSLIOHandlerSocketOpenSSL component. Then you need some SSL DLLs. Search your harddrive for these two files:

libeay32.dll
ssleay32.dll

If you don't have them - you could try this page:


for links to compiled versions of these (they are open source). Alternatively, you could download and install a freeware or shareware program such as any popular FTP program or anything else that can make secure connections. Chances are, this program will use the DLLs above.

Once you've got these DLLs, copy them into the same folder as your project's .EXE file.

For the username and password of the website, put them into the TIdHTTP.Request.Username and TIdHTTP.Request.Password.

See how that goes.
 
Griffyn,

Thank you for your answer, I had to switch from my Indy 9 to indy 10 to have the same IOHandler component as you.
I did what you say, but now, I get a "Connection closed gracefully", and no data is coming ...

Do you have an idea of what's wrong?
 
Show some code, with an indication of which line is causing the exception. Coincidentally, there's another thread (thread102-1464173) that's just wrapped up concerning this exception. Although, as with all exceptions - it's not best practice to simply expect exceptions and handle them in a try..except block.

Every effort should be made to code to avoid exceptions.
 
Looking a the header, I think https is working but look at tje http header i get. I think i have to set a session cookie, and to get an attachment file...
It'a bit strong for me here :p


Date: Thu, 10 Apr 2008 05:08:20 GMT
Server: Apache
Set-Cookie: Apache=89.82.253.168.26325120780410093; path=/; expires=Sun, 08-Apr-18 05:08:20 GMT
Set-Cookie: PHPSESSID=9947680d9e0fef14a595e04ffefb4def; path=/
Expires: 0
Cache-Control: must-revalidate, post-check=0,pre-check=0
Pragma: public
Content-Disposition: attachment; filename=transactions.xml
Connection: close
Transfer-Encoding: chunked
Content-Type: application/xml
Content-Language: en
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top