CURL No Longer Accepts Spaces in URLs?

I’ve been using CURLSMBS for years now without any issues, happily uploading and downloading files with spaces in their names to both FTP and SFTP sites. Now, after updating CURLMBS from 21.0 to 21.4, any URL containing spaces returns an error of 3.

If I revert my MBSCURL plug-in to 21.0, the program works again.

I see that just about every new release of MBS involves an update to the latest CURL library, and I assume this was something that happened in the CURL project and not at MBS - can anyone confirm? Seems like a change that could break a lot of code.

Yes, curl got an unified parser in between. So ftp urls are now more strict.

I presume that’s %20 instead of a space then? Couldn’t curl automatically convert to the stricter format? Then it wouldn’t break older code.

A blog post about the changes and what specifically has changed would be useful too.

That’s one of those that I call a “Thoreau-Change”. Thoreau measured everything in how much life-time it would cost. In this case 1 developer can make the change in under 10 min, or possibly thousands of developers spend a lot longer each with updating their code and testing their apps, wasting a lot of life-time in the process.

1 Like

Yes, %20 works ok.

When I originally started using CURL and saw that it accepted spaces, I was like “Oh, that’s so thoughtful of them to make it that much more human-friendly”.

Absolutely correct re Thoreau. I’m just glad I found the issue before deploying broken apps.

1 Like

@Christian_Schmitz is there some place where the URL restrictions are documented, so I can make sure I’m not using any other illegal characters?

I mean I know the usual things to avoid, but anything else that was legal until just recently.

Possibly start here: What is URL Encoding and How does it work? | URLEncoder

Yeah, I updated my question :slight_smile: I know the usual characters to avoid but wondering if the CURL team changed anything else recently that they used to allow, like spaces.

EncodeURLComponent should do the trick in any case.

Somewhere in the CURL updates last year, we got a new CURL URL parsing API.
See CURLSURLMBS class.

Instead of relaying on over 20 different URL parsers within CURL, everything got unified to use internally the same URL parsing API.

Now that FTP used to accept anything there as path/filename was undocumented behavior or in other words a bug.

Since CURL has the unified parsing API, it uses it everywhere, so all the bugs in the various implementations got fixed.

The number of clients running in such a problem is very low.

1 Like

And here I was thinking I had to do it myself, lol. Thanks :slight_smile:

In my experience, this is ignored; most of the time, the answer is “do it yourself”.

Another common answer is to… remove the feature.

EncodeURLComponent escapes forward slashes, so it doesn’t seem to be much use for FTP file URLs unless there are options I’m not aware of (can’t find any documentation). I’m just escaping spaces myself for the moment.

You need to encode each component itself, not the whole path.

2 Likes
Forum for Xojo Programming Language and IDE. Copyright © 2021 Xojo, Inc.