URLConnection error 1200 ?

@Hal Gumbert: AFAIK you do need to test per target. The errors aren’t even properly documented.

The perfect scenario is using native APIs but abstracting you from the platform specifics. I think URLConnection was rushed out the door a bit because of a bug in HTTPSocket (if memory serves) so there wasn’t time to sit down and make the connection errors platform-agnostic. However, as I mentioned yesterday, I’ve created a feature request to resolve this. It doesn’t seem like a difficult one to do. We won’t be able to cover every possible error as there will be some that are platform specific. A good example is on the Mac when you attempt to connect to an HTTP URL without the appropriate plist entry. However, we can cover a lot of them.

the enums for Windows & macOS error codes are on <https://xojo.com/issue/56384>

Thanks Norman.

can someone please help me with showing how to install a info.plist file inside a xojo project ?
a plist file dedicated to app transport security ?
thanks.

[quote=445479:@Jean-Yves Pochez]can someone please help me with showing how to install a info.plist file inside a xojo project ?
a plist file dedicated to app transport security ?
thanks.[/quote]
Aren’t you supposed to put it as a build step somehow? Here’s a quick google result https://blog.xojo.com/2014/07/14/adding-plist-settings-to-your-os-x-apps/

  1. open a text editor
  2. copy & paste in the code from http://documentation.xojo.com/topics/communication/internet/using_non-secure_urls_on_macos_and_ios.html
  3. save as “info.plist”
  4. drag and drop into your project

its all in the docs already

[quote=445492:@Norman Palardy]1) open a text editor
2) copy & paste in the code from http://documentation.xojo.com/topics/communication/internet/using_non-secure_urls_on_macos_and_ios.html
3) save as “info.plist”
4) drag and drop into your project

its all in the docs already[/quote]
I did that and it does not work
the compiled app has a standard info.plist, and there is my info.plist in the resources folder of the app !

what version are you using ?
mac, windows, linux ?

EDIT : dunno what else it might be as I just performed those steps using BBEDit to edit the text file then dragged it into a brand new desktop app in 2019r1.1
and there’s the plist with my info added to it as I expected

xojo 2019r11 and macos 10.11.6

it’s finally ok ! I had to delete and redrag my info.plist file to the project, and now the app info.plist is ok
and I don’t have the 1200 error anymore !

but
I still have the “malformed web url” error when I hane an url with spaces in it.
how can I fix this ?
I already replaced the spaces with %20 but no luck still the error…

You might need more than just the spaces taken care of: EncodeURLComponent — Xojo documentation

[quote=445458:@Hal Gumbert]That’s cool as long as we don’t need separate error testing per target.

Imagine not having SpecialFolder where you have to use a Case statement to test which target you are on to simply specify a path…[/quote]

Well I’ve figured out how to make the enums on the case I filed <https://xojo.com/issue/56384>
both “platform specific” and generic in one shot :stuck_out_tongue:

EDIT - watch for an upcoming blog post about topics related to this at Writings from the sticks

so I’ve found my last error : “malformed web url”
it because of accentuated chars in the url like or
the EncodeURLComponent does not help here, it makes too much of conversion…
you must replace like this :

anUrl = anUrl.ReplaceAllB( " ", "%20") anUrl = anUrl.ReplaceAllB( "", "%C3%A8") anUrl = anUrl.ReplaceAllB( "", "%C3%A9") anUrl = anUrl.ReplaceAllB( "", "%C3%AA") anUrl = anUrl.ReplaceAllB( "", "%C3%A0") ...

and the 1200 error you must add some info.plist to the (mac) app like described here.
http://documentation.xojo.com/topics/communication/internet/using_non-secure_urls_on_macos_and_ios.html

ah yeah international URLS are such fun :slight_smile:

I’d report those as a bug in EncodeUrlComponent as well as it should handle those (probably others as well)

Not sure what decode should do
Maybe there’s an RFC for both encode & decode

EDIT : and there we go
https://en.wikipedia.org/wiki/Internationalized_Resource_Identifier
https://tools.ietf.org/html/rfc3987