Response.body and file content different? (wodHttpDLX)
Hi,
I only used your sample code (simple get):
- Download a binary file (a GIF file) by using GET
In the Done event I compare the Response.body with the saved temorary file... the filesize is equal, but the content is different!
The GIF file refered in the Response.Filename property is ok, but if I save the Response.Body to a binary file, the GIF is broken. There seems to be mixed text and binary data in it.
Is it correct that body content and filename content should be the same?
Thank you!
Teddy
Re: Response.body and file content different?
Teddy,
I would say this is almost impossible, since Body property is just a wrapper arround the file. We don't keep data in the memory, we write it to a file as it arrives. When you access Body, we read the file and present it as string.
It is possible that this conversion is invalid, perhaps when you use non-English OS?
Re: Response.body and file content different?
I would say this is almost impossible, ...
maybe it's a little bug?
It seems to depend on the order of reading the propertys.
Here's what I wrote:
Dim C1 As String
Dim C2 As String
If ErrorCode = 0 Then
C2 = wodHttp1.Response.Body
C1 = f_ReadFile(wodHttp1.Response.FileName)
If C1 <> C2 Then
MsgBox files are different
Else
MsgBox files are equal
End If
Else
txtResponse.Text = ErrorText
End If
The f_ReadFile function is only a short binary read like this:
FF = FreeFile
Open strFile For Binary Access Read As #FF
C = Space$(LOF(FF))
Get #FF, , C
Close #FF
If you create an EXE and start it, you will get different results on the FIRST TRY. If you click again the button, it will work.
After closing the EXE and restart again, the effect will repeat.
If I exchange the C1/C2 lines like this...
C1 = f_ReadFile(wodHttp1.Response.FileName)
C2 = wodHttp1.Response.Body
...it will work correctly every time.
I can send the complete sample to you if you like.
Teddy
Re: Response.body and file content different?
Yeah, sure, send it over, I'll try it out. But this just doesn't sound right. Send me that GIF file as well that you read.
Re: Response.body and file content different?
Yeah, sure, send it over, I'll try it out. But this just doesn't sound right. Send me that GIF file as well that you read.
it's on the way...
Re: Response.body and file content different?
You have a good eye! This is now fixed.