#1 2017-05-16 12:54:50

lagodny
Member
Registered: 2015-01-28
Posts: 50

TURI does not have Username and Password

I wand to GET http://user:password@host:port/api/command by TWinINet.Get.

InternetConnectA has paramters lpszUsername and lpszPassword, but they always are nil

InternetConnectA(fSession, pointer(fServer), fPort, nil, nil, INTERNET_SERVICE_HTTP, 0, 0)

Is it possible to extract Username and Password from URI and use they in InternetConnect? Or I have to write my descendant?

Offline

#2 2017-05-16 15:09:34

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,237
Website

Re: TURI does not have Username and Password

user:password@host syntax is not handled yet by the class.

Offline

#3 2017-05-16 18:11:09

lagodny
Member
Registered: 2015-01-28
Posts: 50

Re: TURI does not have Username and Password

I see. Is it planned to do?

Offline

#4 2017-05-16 19:18:44

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,237
Website

Re: TURI does not have Username and Password

Not yet, since we don't need it.

For two reasons:
1. WinINet is slow, and not working in a server application.
2. In fact, HTTP authentication should better be implemented after the connection, using the expected algorithm.

Offline

#5 2017-05-17 13:39:28

lagodny
Member
Registered: 2015-01-28
Posts: 50

Re: TURI does not have Username and Password

Ok. If I use TWinHTTP and properly fill ExtendedOptions I get what I need. But I have to care about proxy.
Yes, I read documentation about import the current IE settings. But to do it I need to have admin rights and it does not work when IE "Automatically detect proxy settings" is checked.

So we have to write proxy by hand. sad

What do you say about this piece of code? WinHTTP AutoProxy Support: http://markmail.org/download.xqy?id=4lc … 4&number=1
May be we could forget about TWinINet if we implement it.

Offline

Board footer

Powered by FluxBB