Thanks
daonlyfreez and
Uberi, I learned something new
And, here is the long-awaited update: version (9-10-2011).
BugFix: Options parsing.
BugFix: MD5 function now returns the base64 encoded hash. Also, the automatic value for the Content-MD5 header should be correct for the actual POST data even if uploading a file or after codepage conversion.
New Option: Binary: tells HTTPRequest not to do anything special to downloaded text (no codepage conversion).
New Option: Codepage: tells HTTPRequest to convert the POST text to the codepage specified in the 'charset' attribute of the 'Content-Type' request header.
New Option: Upload: (filepath): HTTPRequest will upload the file as POST data, INSTEAD of whatever is in the 'in_POST_out_Data' parameter.
Tweaked Option: Callback: (Function Name)[, param3]: previously, the callback function had to require either one or two parameters. Now the function may require between 0 and 3 parameters. If the function accepts a third parameter, whatever text appears
after the name of the callback function is passed as the third parameter.
Tweak: If the callback function returns the word "cancel", HTTPRequest will terminate the transaction, clean up, and return the number of bytes downloaded.
Tweaked Option: [N][R]> (output file): Two modifiers for the output file option change how the download is handled. The 'N' modifier prevents HTTPRequest from reading the file's contents into 'in_POST_out_Data' (convenient for large downloads). The 'R' option is a shortcut for the
Range: header, and IF the file exists, HTTPRequest will attempt to resume downloading it.
Tweak: Cookie headers no longer need +INTERNET_FLAG_NO_COOKIES specified in the options.
Tweak: Options flags no longer need the word 'flag:' in front, a single '+' or '-' tells HTTPRequest to look at the option as a flag.
A note about resuming the download: I had considered following dadepp's example more closely and implemented more stringent validity checks. In the end, I decided just to check for the '206 Partial Content' response code before writing to the file.
As always, let me know if you find any bugs.