This is the first time I've come across InetGetSize returning 0, I have an example below (though sometimes it will report a size greater than 0.) Having done a bit of research on the Forum, it appears that it used to be a bug in InetGetSize, though I have a WinHttp version which returns exactly the same result as InetGetSize, so I doubt this is a bug with InetGetSize today.
I'm wondering is this a flaw in the header that is sent from the server or the functions? I'm going with the server, but would like to know your thoughts too.
AutoIt v3.3.8.1.
AutoIt
#include <Array.au3> #include <Constants.au3> #include 'WinHttp.au3' ; From the examples section. By trancexx. Local $sURL = 'http://pgl.yoyo.org/as/serverlist.php?hostformat=hosts&showintro=1&mimetype=plaintext' MsgBox($MB_SYSTEMMODAL, '', InetGetSize($sURL)) MsgBox($MB_SYSTEMMODAL, '', _InetGetSize($sURL)) ; WinHttp version. By guinness - 2013. Func _InetGetSize($sURL) Local $iInetSize = 0 ; Crack the URL into parts. Local Enum $eDomain = 2, $ePage = 6, $eExtraInfo Local $aURL = _WinHttpCrackUrl($sURL) If @error Then Return SetError(1, 0, $iInetSize) EndIf ; Initialize and get a session handle Local $hOpen = _WinHttpOpen() ; Get a connection handle. Local $hConnect = _WinHttpConnect($hOpen, $aURL[$eDomain]) ; Make a request. Local $hRequest = _WinHttpOpenRequest($hConnect, Default, $aURL[$ePage] & $aURL[$eExtraInfo]) ; Send a request. Specify additional data to send too. _WinHttpSendRequest($hRequest, Default) ; Wait for the response. _WinHttpReceiveResponse($hRequest) ConsoleWrite('DEBUG:' & @CRLF) ConsoleWrite(_WinHttpQueryHeaders($hRequest) & @CRLF) ; Query the header for content length. $iInetSize = Int(_WinHttpQueryHeaders($hRequest, $WINHTTP_QUERY_CONTENT_LENGTH)) ; Close handles _WinHttpCloseHandle($hRequest) _WinHttpCloseHandle($hConnect) _WinHttpCloseHandle($hOpen) Return $iInetSize EndFunc ;==>_InetGetSize