On a sidenote you should realize that the script you posted will corrupt the file as it downloads if you use the HTTP/1.1 protocol. The 1.1 protocol sends the <bytesleft> value in the stream every (few) packet(s) and unless you ignore it you'll likely /bwrite invalid data. Either handle the bytesleft value or use the HTTP/1.0 protocol in your GET request.