Sign in to follow this  
Followers 0
Tankbuster

InetGetSize in Gigabytes

8 posts in this topic

Hello,

I found in the 3.3.4.0 the new function InetGetSize.

Nice but if I query a file about 6.1 GB it looks like the value returnd is an integer.

6.1 GB = -2038644736.

Is this realetd to Autoit or to the webserver ?

How do I avoid this issue?

Is there a way to get the real value.

(btw: I searched the manual and the forum ....)

Thank you.

Share this post


Link to post
Share on other sites



6.1 GB is a value that is larger than a 32 bit integer can hold. AutoIt works with 32 bit signed integers for the most part but has support for 64 bit integers on certain functions.

This problem is due to AutoIt not having enough space to work with the number using the current implementation. You might consider filing a bug report.

Share this post


Link to post
Share on other sites

This problem is due to AutoIt not having enough space to work with the number using the current implementation. You might consider filing a bug report.

Ok, that was actually what was the result after studying the docu, but I wanted to be sure.

I will try the bug report / RFC.

Thank you very much.

Share this post


Link to post
Share on other sites

The issue could also be related to the webserver. I've seen files bigger than 2gb on some webservers that shows as 2gb in size even I use 64 bit windows.

Share this post


Link to post
Share on other sites

Seems like a local (AutoIt) 32-bit weakness. Try with this 2.6 Gb Linux ISO:

http://mirrors.kernel.org/gentoo/releases/amd64/10.1/livedvd-amd64-multilib-10.1.iso

The site announces the right size, just as FireFox if you try to download it this way, but InetGetInfo reports a file size of -1496317952 bytes.

Can you try on various platforms and confirm, please.


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites

I added a bug report.

There is a simple solution.

Don't use HTTP_QUERY_FLAG_NUMBER for that at all. Go directly with wchar buffer.


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

Until then, you can use the MrCreatoR's _InetGetSizeEx() function.

ConsoleWrite(_InetGetSizeEx('http://mirrors.kernel.org/gentoo/releases/amd64/10.1/livedvd-amd64-multilib-10.1.iso') & @CR)

Func _InetGetSizeEx($sURL)
    TCPStartup()
    Local $sHost = StringRegExpReplace($sURL, ".*://(.*?)/.*", "\1")
    Local $sPage = StringRegExpReplace($sURL, ".*://.*?(/.*)", "\1")
    Local $sName_To_IP = TCPNameToIP($sHost)
    Local $iSocket = TCPConnect($sName_To_IP, 80)
    If $iSocket = -1 Then
        TCPShutdown()
        Return SetError(1, 0, "")
    EndIf
    Local $sCommand = "HEAD " & $sPage & " HTTP/1.1" & @CRLF
    $sCommand &= "Host: " & $sHost & @CRLF
    $sCommand &= "User-Agent: AutoIt/" & @AutoItVersion & " (Windows; U; Windows NT 5.1; en-US; rv:1.8.1)" & @CRLF
    $sCommand &= "Referer: " & $sHost & @CRLF
    $sCommand &= "Connection: close" & @CRLF & @CRLF
    Local $BytesSent = TCPSend($iSocket, $sCommand)
    If $BytesSent = 0 Then
        TCPShutdown()
        Return SetError(2, @error, 0)
    EndIf
    Local $sRecv = "", $sCurrentRecv
    While 1
        $sCurrentRecv = TCPRecv($iSocket, 16)
        If @error <> 0 Then ExitLoop
        If $sCurrentRecv <> "" Then $sRecv &= $sCurrentRecv
    WEnd
    TCPCloseSocket($iSocket)
    TCPShutdown()
    $sRecv = StringRegExpReplace($sRecv, "(?s).*Content-Length: (.*?)[\r\n].*", "\1")
    If @extended = 0 Then Return SetError(2, 0, "")
    Return $sRecv
EndFunc   ;==>_InetGetSizeEx

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0