I need UnPackedSize value, so that after complete file downloading to perform additional verification (compare two values). UnPackedSize value on the server and real file size after unpacking to know that
file didn't break on the road).
Is it a corrupted or empty archive?
Neither one. This is not a fully downloaded archive. However, it has correct header. As well as a chunk of data correct relative to the original file.
Please, launch this code, which kindly provided by
infratec:
Code: Select all
#BlockSize = 1024000
InitNetwork()
;Debug ReceiveHTTPFile("http://download.2gis.com/arhives/2GISData_Minvody-84.0.0.zip", "c:\tmp\2GISData_Minvody-84.0.0.zip")
NewMap HeaderMap$()
File = CreateFile(#PB_Any, "c:\tmp\2GISData_Minvody-84.0.0.zip")
If File
Repeat
ResetMap(HeaderMap$())
Debug "bytes=" + Str(StartAddr) + "-" + Str(StartAddr + #BlockSize - 1)
HeaderMap$("Range") = "bytes=" + Str(StartAddr) + "-" + Str(StartAddr + #BlockSize - 1)
HTTPRequest = HTTPRequest(#PB_HTTP_Get, "http://download.2gis.com/arhives/2GISData_Minvody-84.0.0.zip", "", 0, HeaderMap$())
If HTTPRequest
*Buffer = HTTPMemory(HTTPRequest)
If *Buffer
WriteData(File, *Buffer, MemorySize(*Buffer))
If MemorySize(*Buffer) < #BlockSize
Exit = #True
EndIf
FreeMemory(*Buffer)
EndIf
FinishHTTP(HTTPRequest)
EndIf
StartAddr + #BlockSize
Until Exit
CloseFile(File)
EndIf
Wait a while. Then stop processing. Now you have source data. That is, only part of the full archive. Now run the code above(from my first post).
FLink$ = path to partially downloaded file.
PB 5.72 LTS & Windows 7. Both are x86.
P.S. Marc56us, thank you for try to help me. Your code is OK. Now try what I do, please.
P.S.2 I apologize, but I have to go. I’ll read your answers only tomorrow. Thanks in advance for your help.