inetget doesn't work on some sites

16 posts in this topic

JayDoubleEw 0

Long time user of AutoIT, but first time poster since I'm a little lost on this. I've a simple inetget function that works for most of my users except one. Basically my application download several files, parses the contents and display them in the application. However, inetget isn't working for one user.

Here's the code sample - it's mostly just based off the default example

Func DownloadFile($file_to_download,$file_to_saveas); Download a file in the background.; Wait for the download to complete.; Save the downloaded file to the temporary folder.; Download the file in the background with the selected option of 'force a reload from the remote site.'Local$hDownload=InetGet($file_to_download,$file_to_saveas,$INET_FORCERELOAD,$INET_DOWNLOADBACKGROUND); Wait for the download to complete by monitoring when the 2nd index value of InetGetInfo returns True.DoSleep(250)UntilInetGetInfo($hDownload,$INET_DOWNLOADCOMPLETE); Retrieve the number of total bytes received and the filesize.Local$iBytesSize=InetGetInfo($hDownload,$INET_DOWNLOADREAD)Local$iFileSize=FileGetSize($file_to_saveas); Close the handle returned by InetGet.InetClose($hDownload); MsgBox("","",$file_to_saveas & @CRLF & $file_to_download)EndFunc;==>DownloadFile

One thing I DID notice was that some sites work (e.g. Google), but other internal sites (http/https) does not. Some of those internal sites when browsed via browser requires log in to proceed further, but just downloading the login page (as a test) SHOULD work.

Share this post

Link to post

Share on other sites

JayDoubleEw 0

Well, I thought of that, so I tested running inetget against multiple sites in a single executable, and it works on some sites but not others, so I know it's not an AV/FW issue. My best guess at the moment is potentially IE related, but the user is able to access (and download) the files if I use IE directly.

Share this post

Link to post

Share on other sites

JayDoubleEw 0

We have both - an in house developed web system and also a public web system (Atlassian product); both do not work.

As for how I know it isn't working - as my first post mentioned; the application download files, reads the content and then displays them out in the AutoIT application. If it fails to download the file, it errors out. To test it further, I did a pure file download app only that saves to temp to see what happens. The @error is zero for ALL sites. Here's the sample standalone and $dlPath is the URLs

- Just realized my @error may have been at the wrong place though ...

Func Example($dlPath); Save the downloaded file to the temporary folder.Local$sFilePath=_WinAPI_GetTempFileName(@TempDir)MsgBox('','',$sFilePath); Read the file without downloading to a folder. The option of 'get the file from the local cache' has been selected.Local$dData=InetRead($dlPath); The number of bytes read is returned using the @extended macro.Local$iBytesRead=@extended; Convert the ANSI compatible binary string back into a string.Local$sData=BinaryToString($dData); Display the results.MsgBox($MB_SYSTEMMODAL,"","The number of bytes read: "&$iBytesRead&@CRLF&@CRLF&$sData)Local$iSize=InetGetSize($dlPath)MsgBox($MB_SYSTEMMODAL,"","The size of the file: "&$iSize); Download the file in the background with the selected option of 'force a reload from the remote site.'Local$hDownload=InetGet($dlPath,$sFilePath,$INET_FORCERELOAD,$INET_DOWNLOADBACKGROUND); Wait for the download to complete by monitoring when the 2nd index value of InetGetInfo returns True.DoSleep(250)UntilInetGetInfo($hDownload,$INET_DOWNLOADCOMPLETE); Retrieve the number of total bytes received and the filesize.Local$iBytesSize=InetGetInfo($hDownload,$INET_DOWNLOADREAD);MsgBox('','',@error)Local$iFileSize=FileGetSize($sFilePath); Close the handle returned by InetGet.InetClose($hDownload); Display details about the total number of bytes read and the filesize.MsgBox($MB_SYSTEMMODAL,"","The total download size: "&$iBytesSize&@CRLF&_"The total filesize: "&$iFileSize); Delete the file.;FileDelete($sFilePath)EndFunc;==>Example

Share this post

Link to post

Share on other sites

willichan 194

I have an Atlassian account I can test against. Which service is giving the problem? You don't need to give me any private information, but if you could tell me roughly what you are downloading, I can test from my end and see what I can find.

Share this post

Link to post

Share on other sites

JayDoubleEw 0

It's just the login page (e.g. http://internal-crucible:8080) - the application doesn't connect to external Atlassian (or even internal for any POST/GET). I'm just using it for testing. In actual fact, the application connects to an internally developed web-server just to query a file e.g. http://internal-site/files/foo.txt and processes the contents there.

Share this post

Link to post

Share on other sites

willichan 194

I am not sure how much we will be able to help. You may need to confer with your internal web developers.

Final two thoughts:

Have you confirmed that the http://internal-site/files/foo.txt file is not empty by manually downloading it?

Have you tried using the same URL you are passing to inetget with WGET to see if it gives the same result? If you get the same result, then it definitely looks like a problem with the in-house developed page or the server it is running on.

Share this post

Link to post

Share on other sites

JayDoubleEw 0

As mentioned, it's definitely not the server OR the page because everyone else, myself included are running the same application and working fine.

I did find out something though - it turns on when the user launches IE, he's seeing a Security Alert - Revocation information for the security certificate for this site is not available. Could this be the cause? Testing seems to indicate it to be i.e. I can now confirm on the laptop, running InetGet against -> external site, internal site (not using that particular certificate) works. Any site(s) needing the root certificate fails.