QB64-Phoenix-Edition / QB64pe

The QB64 Phoenix Edition Repository
https://qb64phoenix.com
Other
125 stars 26 forks source link

_OpenClient() with an HTTP URL should automatically do the necessary URL encoding. #259

Open mkilgore opened 1 year ago

mkilgore commented 1 year ago

Currently when passing a HTTP URL to _OpenClient() (when using $Unstable:Http) you have to encode any characters that aren't allowed in HTTP URLs, such as using %20 for spaces. Really this is just an extra complication for developers, _OpenClient() can just do the encoding for them. libcurl already provides the functionality to do this so it should be relatively straight forward to do.

We should also consider decoding the URL returned from _ConnectionAddress$().

mkilgore commented 1 year ago

Apparently curl_easy_escape() and curl_easy_unescape() don't entirely do the job here, which is annoying. curl_easy_escape() needs to be passed the specific pieces of data to escape, not the entire URL, so we'll have to do some splitting on the URL to determine which parts should be escaped (Ex. domain shouldn't be escaped, path segments should be escaped, slashes should not, ? and & should not, etc...)