5.43 - ReceiveHTTPFile error
Posted: Tue Oct 25, 2016 4:16 pm
When the file to be received does not exist, Vs 5.4+ are returning a 1 (success) when it should return a 0 (failure).
Version up through 5.31 return a 0 if the requested file does not exist, as expected and described in the Help file.
Try this code
The file to be received DOES NOT exist, so the ReceiveHTTPFile command should return a 0. Instead it returns a 1.
And it actually stores a file containing
Version up through 5.31 return a 0 if the requested file does not exist, as expected and described in the Help file.
I tested with Vs 5.41 and 5.43, and 5.50 and they return a 1 (success) and store a file insteadReturn value
Returns nonzero if the download was successful, zero otherwise. If #PB_HTTP_Asynchronous was specified, it returns the 'HttpConnection' value needed for HTTPProgress(), AbortHTTP() and FinishHTTP().
Try this code
Code: Select all
InitNetwork()
Filename$ = "C:\Temp\TestFile.jpg"
Result = ReceiveHTTPFile("http://www.purebasic.com/TestFile.jpg", Filename$)
If Result
MessageRequester("Debug", "ReceiveHTTPFile return a " + Str(result), #MB_ICONINFORMATION)
Else
MessageRequester("Debug", "ReceiveHTTPFile return a " + Str(result), #MB_ICONERROR)
EndIf
End
And it actually stores a file containing
Code: Select all
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /TestFile.jpg was not found on this server.</p>
<hr>
<address>Apache/2.2.22 (Debian) Server at www.purebasic.com Port 80</address>
</body></html>