Hello,
I have just updated an app of mine replacing HTTPSecureSockets with URLconnection, and it seems everything works OK.
But I still have a few questions:
- when resuming an interrupted download, is it all right to write to the file (gBS) in the ReceivingProgresses event, as I used to do with the HTTPSecureSocket?
Or should I do something else?
Sub ReceivingProgressed(bytesReceived As Int64, totalBytes As Int64, newData As String) Handles ReceivingProgressed
if resumingDownloads then
if gBS <> nil then
gBS.Position = gBS.Length
gBS.Write newData
end if
end if
End Sub
-
Redirect found (i.e. HTTPstatus = 301 and HTTPstatus = 302): when using the old socket I used to deal with it in the DownloadComplete event extracting the new location from the Headers. Now, using URLconnections, am I right in supposing that the URL parameter in the FileReceived event already points to the new location?
Or should I query me.ResponseHeader(“Location”) to get the new one?
Unfortunately, in order to test it, I don’t have at hand an url requiring redirection. -
Authentication: if name & pw are not passed in code, is still OK to intercept a HTTPstatus = 401 in the FileReceived event?
Also in this case, I do not have an URL to make a test. -
How to deal with cookies? With HTTPSecureSocket I used to check in the HeaderReceived event:
if headers.nameCount(“Set-Cookie”) > 0 then
//relevant code
end if
Now I’m in the fog. (smily!).
Suggestions appreciated. Thank you.
BTW: maybe I should have made four different conversations…