I attempt to retrieve data from a URLConnection using the get command. When the ContentReceived Event is triggered, content as string is empty for a number of URL addresses.
Curiously, this is the case when I run my code under Xojo 2024 Release 4.1. However, when the same code is run under Xojo Release 1 or older, content is not empty. See sample project.
It does not matter if .followredirects is true or false, which appears to be one change in release 4.1.
I should add the running under Release 4.1, content is always empty. Running under Release 1, is a bit intermittent, sometimes with content and sometimes not.
i got an answer at windows 11.
you should also add the error event.
and useful message output in the first line of a event System.DebugLog CurrentMethodName
The text area displays what is returned in contents when a URLConnection ContentReceived is triggered. When contents is not empty the text area is filled with the data returned by the URL. When contents is empty (i.e., contents=āā), the text area is empty. Under Release 4.1, content is always empty. Under Release 1, I often see that contents is not empty and I am receiving data.
Iām not sure if youāre hoping to solve this problem just with the aid of forum members, or to have Xojo engineers looking into it.
If you want Xojo to look into this problem officially, you need to create an Issue. Describe the unexpected behaviour best you can, include your Xojo versions and OS version and your sample project.
Otherwise, it is unpredictable if and when a Xojo engineer may look at your post here.
Playing a little bit with Curl, looks like CNBC sometimes send a redirect (301) but not always (thatās why AAPL answered for me).
And sometimes the redirect takes longer.
Could be that Xojo is no longer waiting much time for redirect (compared with older versions), so you get sometimes response with older Xojo and now is always empty?
As Scott said, create an Issue for Xojo staff to review.
I tested on macOS 15.2 with Xojo 2024r4.1. I always get a response when FollowRedirects = True, but never when FollowRedirects = False. This is likely due to the source redirecting the request with HTTP status code 301. There are some instances where it seems the server takes more than two seconds to respond, but I always get a response.