]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
curl_easy_escape: elaborate a little on encoding a URL
authorDaniel Stenberg <daniel@haxx.se>
Mon, 1 Jul 2024 08:11:39 +0000 (10:11 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 1 Jul 2024 08:45:59 +0000 (10:45 +0200)
Closes #14069

docs/libcurl/curl_easy_escape.md
docs/libcurl/curl_easy_unescape.md

index 272d607171d0bff8bf539b1711ffebb70a183587..e153f3ca908f662c73b1e61c581f77dbb1e23aec 100644 (file)
@@ -6,7 +6,8 @@ Section: 3
 Source: libcurl
 See-also:
   - curl_easy_unescape (3)
-  - curl_free (3)
+  - curl_url_set (3)
+  - curl_url_get (3)
 Protocol:
   - All
 ---
@@ -51,6 +52,17 @@ uses.
 The caller of curl_easy_escape(3) must make sure that the data passed in
 to the function is encoded correctly.
 
+# URLs
+
+URLs are by definition *URL encoded*. To create a proper URL from a set of
+components that may not be URL encoded already, you cannot just URL encode the
+entire URL string with curl_easy_escape(3), because it then also converts
+colons, slashes and other symbols that you probably want untouched.
+
+To create a proper URL from strings that are not already URL encoded, we
+recommend using libcurl's URL API: set the pieces with curl_url_set(3) and get
+the final correct URL with curl_url_get(3).
+
 # EXAMPLE
 
 ~~~c
index a99b4e30f6e2f4975f476a8191bcee6bb559ee88..5e507ad8b4423c9fd60362dca7beb94f8d9eee5a 100644 (file)
@@ -6,7 +6,7 @@ Section: 3
 Source: libcurl
 See-also:
   - curl_easy_escape (3)
-  - curl_free (3)
+  - curl_url_get (3)
 Protocol:
   - All
 ---