WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

WinInet
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

iHostConnect and Return Codes

Keywords: 

Question:

In the following script, why does iHostConnect return a handle for this bogus URL?
AddExtender("WWINT34i.DLL")
tophandle=iBegin(0,"","")
conhandle=iHostConnect(tophandle,"www.aksdfhkfhlksdfhklf.org",@HTTP, "","")
message(iGetResponse(),conhandle)
;conhandle=iHostConnect(tophandle,"www.worldwideschool.org",@HTTP, "","")
datahandle=iHttpInit(conhandle, "GET", "/", "",0)
rslt=iHttpOpen(datahandle, "", 0, 0)
xx=iReadData(datahandle, "C:\temp\abc.txt")
iclose(datahandle)
iClose(conhandle)
iClose(tophandle)
Message("All","Done")
exit

Answer:

ihostconnect is not designed to validate a hostname. To capture an error for an invalid host you would have to execute the httpinit inorder to get a HTTP response...
AddExtender("WWINT34i.DLL")
tophandle=iBegin(0,"","")
conhandle=iHostConnect(tophandle,"www.aksdfhkfhlksdfhklf.org",@HTTPS,"","")
datahandle=iHttpInit(conhandle, "GET", "/", "",0)
rslt=iHttpOpen(datahandle, "", 0, 0)
message("ERROR",igetlasterror())

Article ID:   W14807
File Created: 2001:11:08:12:40:04
Last Updated: 2001:11:08:12:40:04