Theo Carr-Brion
2005-04-29 13:08:02 UTC
I am new to wininet and I am trying to do a HTTPS POST using wininet. It is
to be used where I do not know if the internet connection is via a proxy or
not. I would like it to connect automatically using settings from windows so
that we can say to the users that if the URL works in internet explorer it
will work in our application. What do I use for the third parameter of
InternetConnect as I do not know which port number to use? I have tried the
following but if fails if I include the flag INTERNET_FLAG_SECURE. If I do
not include this how does it know to do a secure connection?
NetHandle:=InternetOpen('MSIE 6.0', INTERNET_OPEN_TYPE_PRECONFIG, nil,
nil, 0);
if Assigned(NetHandle) then
begin
try
UrlHandle:=InternetConnect(NetHandle, PChar(lServer),
INTERNET_INVALID_PORT_NUMBER, nil, nil, INTERNET_SERVICE_HTTP, 0, 0);
if Assigned(UrlHandle) then
begin
try
RequestHandle:=HttpOpenRequest(UrlHandle, 'POST', PChar(lPath),
'HTTP/1.1', '', nil, INTERNET_FLAG_NO_CACHE_WRITE
or INTERNET_FLAG_SECURE or
INTERNET_FLAG_NO_UI or
INTERNET_FLAG_PRAGMA_NOCACHE, 0);
Thank you,
Theo Carr-Brion
to be used where I do not know if the internet connection is via a proxy or
not. I would like it to connect automatically using settings from windows so
that we can say to the users that if the URL works in internet explorer it
will work in our application. What do I use for the third parameter of
InternetConnect as I do not know which port number to use? I have tried the
following but if fails if I include the flag INTERNET_FLAG_SECURE. If I do
not include this how does it know to do a secure connection?
NetHandle:=InternetOpen('MSIE 6.0', INTERNET_OPEN_TYPE_PRECONFIG, nil,
nil, 0);
if Assigned(NetHandle) then
begin
try
UrlHandle:=InternetConnect(NetHandle, PChar(lServer),
INTERNET_INVALID_PORT_NUMBER, nil, nil, INTERNET_SERVICE_HTTP, 0, 0);
if Assigned(UrlHandle) then
begin
try
RequestHandle:=HttpOpenRequest(UrlHandle, 'POST', PChar(lPath),
'HTTP/1.1', '', nil, INTERNET_FLAG_NO_CACHE_WRITE
or INTERNET_FLAG_SECURE or
INTERNET_FLAG_NO_UI or
INTERNET_FLAG_PRAGMA_NOCACHE, 0);
Thank you,
Theo Carr-Brion