Mercurial > hgrepos > Python2 > PyMuPDF
comparison mupdf-source/thirdparty/curl/docs/libcurl/opts/CURLOPT_URL.3 @ 2:b50eed0cc0ef upstream
ADD: MuPDF v1.26.7: the MuPDF source as downloaded by a default build of PyMuPDF 1.26.4.
The directory name has changed: no version number in the expanded directory now.
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Mon, 15 Sep 2025 11:43:07 +0200 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 1:1d09e1dec1d9 | 2:b50eed0cc0ef |
|---|---|
| 1 .\" ************************************************************************** | |
| 2 .\" * _ _ ____ _ | |
| 3 .\" * Project ___| | | | _ \| | | |
| 4 .\" * / __| | | | |_) | | | |
| 5 .\" * | (__| |_| | _ <| |___ | |
| 6 .\" * \___|\___/|_| \_\_____| | |
| 7 .\" * | |
| 8 .\" * Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al. | |
| 9 .\" * | |
| 10 .\" * This software is licensed as described in the file COPYING, which | |
| 11 .\" * you should have received as part of this distribution. The terms | |
| 12 .\" * are also available at https://curl.haxx.se/docs/copyright.html. | |
| 13 .\" * | |
| 14 .\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell | |
| 15 .\" * copies of the Software, and permit persons to whom the Software is | |
| 16 .\" * furnished to do so, under the terms of the COPYING file. | |
| 17 .\" * | |
| 18 .\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | |
| 19 .\" * KIND, either express or implied. | |
| 20 .\" * | |
| 21 .\" ************************************************************************** | |
| 22 .\" | |
| 23 .TH CURLOPT_URL 3 "17 Jun 2014" "libcurl 7.37.0" "curl_easy_setopt options" | |
| 24 .SH NAME | |
| 25 CURLOPT_URL \- provide the URL to use in the request | |
| 26 .SH SYNOPSIS | |
| 27 #include <curl/curl.h> | |
| 28 | |
| 29 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_URL, char *URL); | |
| 30 .SH DESCRIPTION | |
| 31 Pass in a pointer to the \fIURL\fP to work with. The parameter should be a | |
| 32 char * to a zero terminated string which must be URL-encoded in the following | |
| 33 format: | |
| 34 | |
| 35 scheme://host:port/path | |
| 36 | |
| 37 For a greater explanation of the format please see RFC3986. | |
| 38 | |
| 39 libcurl doesn't validate the syntax or use this variable until the transfer is | |
| 40 issued. Even if you set a crazy value here, \fIcurl_easy_setopt(3)\fP will | |
| 41 still return \fICURLE_OK\fP. | |
| 42 | |
| 43 If the given URL is missing a scheme name (such as "http://" or "ftp://" etc) | |
| 44 then libcurl will make a guess based on the host. If the outermost sub-domain | |
| 45 name matches DICT, FTP, IMAP, LDAP, POP3 or SMTP then that protocol will be | |
| 46 used, otherwise HTTP will be used. Since 7.45.0 guessing can be disabled by | |
| 47 setting a default protocol, see \fICURLOPT_DEFAULT_PROTOCOL(3)\fP for details. | |
| 48 | |
| 49 Should the protocol, either that specified by the scheme or deduced by libcurl | |
| 50 from the host name, not be supported by libcurl then | |
| 51 \fICURLE_UNSUPPORTED_PROTOCOL\fP will be returned from either the | |
| 52 \fIcurl_easy_perform(3)\fP or \fIcurl_multi_perform(3)\fP functions when you | |
| 53 call them. Use \fIcurl_version_info(3)\fP for detailed information of which | |
| 54 protocols are supported by the build of libcurl you are using. | |
| 55 | |
| 56 \fICURLOPT_PROTOCOLS(3)\fP can be used to limit what protocols libcurl will | |
| 57 use for this transfer, independent of what libcurl has been compiled to | |
| 58 support. That may be useful if you accept the URL from an external source and | |
| 59 want to limit the accessibility. | |
| 60 | |
| 61 The \fICURLOPT_URL(3)\fP string will be ignored if \fICURLOPT_CURLU(3)\fP is | |
| 62 set. | |
| 63 | |
| 64 \fICURLOPT_URL(3)\fP or \fICURLOPT_CURLU(3)\fP \fBmust\fP be set before a | |
| 65 transfer is started. | |
| 66 | |
| 67 The host part of the URL contains the address of the server that you want to | |
| 68 connect to. This can be the fully qualified domain name of the server, the | |
| 69 local network name of the machine on your network or the IP address of the | |
| 70 server or machine represented by either an IPv4 or IPv6 address. For example: | |
| 71 | |
| 72 http://www.example.com/ | |
| 73 | |
| 74 http://hostname/ | |
| 75 | |
| 76 http://192.168.0.1/ | |
| 77 | |
| 78 http://[2001:1890:1112:1::20]/ | |
| 79 | |
| 80 It is also possible to specify the user name, password and any supported login | |
| 81 options as part of the host, for the following protocols, when connecting to | |
| 82 servers that require authentication: | |
| 83 | |
| 84 http://user:password@www.example.com | |
| 85 | |
| 86 ftp://user:password@ftp.example.com | |
| 87 | |
| 88 smb://domain%2fuser:password@server.example.com | |
| 89 | |
| 90 imap://user:password;options@mail.example.com | |
| 91 | |
| 92 pop3://user:password;options@mail.example.com | |
| 93 | |
| 94 smtp://user:password;options@mail.example.com | |
| 95 | |
| 96 At present only IMAP, POP3 and SMTP support login options as part of the host. | |
| 97 For more information about the login options in URL syntax please see RFC2384, | |
| 98 RFC5092 and IETF draft draft-earhart-url-smtp-00.txt (Added in 7.31.0). | |
| 99 | |
| 100 The port is optional and when not specified libcurl will use the default port | |
| 101 based on the determined or specified protocol: 80 for HTTP, 21 for FTP and 25 | |
| 102 for SMTP, etc. The following examples show how to specify the port: | |
| 103 | |
| 104 http://www.example.com:8080/ - This will connect to a web server using port | |
| 105 8080 rather than 80. | |
| 106 | |
| 107 smtp://mail.example.com:587/ - This will connect to a SMTP server on the | |
| 108 alternative mail port. | |
| 109 | |
| 110 The path part of the URL is protocol specific and whilst some examples are | |
| 111 given below this list is not conclusive: | |
| 112 | |
| 113 .IP HTTP | |
| 114 The path part of an HTTP request specifies the file to retrieve and from what | |
| 115 directory. If the directory is not specified then the web server's root | |
| 116 directory is used. If the file is omitted then the default document will be | |
| 117 retrieved for either the directory specified or the root directory. The exact | |
| 118 resource returned for each URL is entirely dependent on the server's | |
| 119 configuration. | |
| 120 | |
| 121 http://www.example.com - This gets the main page from the web server. | |
| 122 | |
| 123 http://www.example.com/index.html - This returns the main page by explicitly | |
| 124 requesting it. | |
| 125 | |
| 126 http://www.example.com/contactus/ - This returns the default document from | |
| 127 the contactus directory. | |
| 128 | |
| 129 .IP FTP | |
| 130 The path part of an FTP request specifies the file to retrieve and from what | |
| 131 directory. If the file part is omitted then libcurl downloads the directory | |
| 132 listing for the directory specified. If the directory is omitted then | |
| 133 the directory listing for the root / home directory will be returned. | |
| 134 | |
| 135 ftp://ftp.example.com - This retrieves the directory listing for the root | |
| 136 directory. | |
| 137 | |
| 138 ftp://ftp.example.com/readme.txt - This downloads the file readme.txt from the | |
| 139 root directory. | |
| 140 | |
| 141 ftp://ftp.example.com/libcurl/readme.txt - This downloads readme.txt from the | |
| 142 libcurl directory. | |
| 143 | |
| 144 ftp://user:password@ftp.example.com/readme.txt - This retrieves the readme.txt | |
| 145 file from the user's home directory. When a username and password is | |
| 146 specified, everything that is specified in the path part is relative to the | |
| 147 user's home directory. To retrieve files from the root directory or a | |
| 148 directory underneath the root directory then the absolute path must be | |
| 149 specified by prepending an additional forward slash to the beginning of the | |
| 150 path. | |
| 151 | |
| 152 ftp://user:password@ftp.example.com//readme.txt - This retrieves the readme.txt | |
| 153 from the root directory when logging in as a specified user. | |
| 154 | |
| 155 .IP SMTP | |
| 156 The path part of a SMTP request specifies the host name to present during | |
| 157 communication with the mail server. If the path is omitted then libcurl will | |
| 158 attempt to resolve the local computer's host name. However, this may not | |
| 159 return the fully qualified domain name that is required by some mail servers | |
| 160 and specifying this path allows you to set an alternative name, such as | |
| 161 your machine's fully qualified domain name, which you might have obtained | |
| 162 from an external function such as gethostname or getaddrinfo. | |
| 163 | |
| 164 smtp://mail.example.com - This connects to the mail server at example.com and | |
| 165 sends your local computer's host name in the HELO / EHLO command. | |
| 166 | |
| 167 smtp://mail.example.com/client.example.com - This will send client.example.com in | |
| 168 the HELO / EHLO command to the mail server at example.com. | |
| 169 | |
| 170 .IP POP3 | |
| 171 The path part of a POP3 request specifies the message ID to retrieve. If the | |
| 172 ID is not specified then a list of waiting messages is returned instead. | |
| 173 | |
| 174 pop3://user:password@mail.example.com - This lists the available messages for | |
| 175 the user | |
| 176 | |
| 177 pop3://user:password@mail.example.com/1 - This retrieves the first message for | |
| 178 the user | |
| 179 | |
| 180 .IP IMAP | |
| 181 The path part of an IMAP request not only specifies the mailbox to list (Added | |
| 182 in 7.30.0) or select, but can also be used to check the UIDVALIDITY of the | |
| 183 mailbox, to specify the UID, SECTION (Added in 7.30.0) and PARTIAL octets | |
| 184 (Added in 7.37.0) of the message to fetch and to specify what messages to | |
| 185 search for (Added in 7.37.0). | |
| 186 | |
| 187 imap://user:password@mail.example.com - Performs a top level folder list | |
| 188 | |
| 189 imap://user:password@mail.example.com/INBOX - Performs a folder list on the | |
| 190 user's inbox | |
| 191 | |
| 192 imap://user:password@mail.example.com/INBOX/;UID=1 - Selects the user's inbox | |
| 193 and fetches message with uid = 1 | |
| 194 | |
| 195 imap://user:password@mail.example.com/INBOX/;MAILINDEX=1 - Selects the user's inbox | |
| 196 and fetches the first message in the mail box | |
| 197 | |
| 198 imap://user:password@mail.example.com/INBOX;UIDVALIDITY=50/;UID=2 - Selects | |
| 199 the user's inbox, checks the UIDVALIDITY of the mailbox is 50 and fetches | |
| 200 message 2 if it is | |
| 201 | |
| 202 imap://user:password@mail.example.com/INBOX/;UID=3/;SECTION=TEXT - Selects the | |
| 203 user's inbox and fetches the text portion of message 3 | |
| 204 | |
| 205 imap://user:password@mail.example.com/INBOX/;UID=4/;PARTIAL=0.1024 - Selects | |
| 206 the user's inbox and fetches the first 1024 octets of message 4 | |
| 207 | |
| 208 imap://user:password@mail.example.com/INBOX?NEW - Selects the user's inbox and | |
| 209 checks for NEW messages | |
| 210 | |
| 211 imap://user:password@mail.example.com/INBOX?SUBJECT%20shadows - Selects the | |
| 212 user's inbox and searches for messages containing "shadows" in the subject | |
| 213 line | |
| 214 | |
| 215 For more information about the individual components of an IMAP URL please | |
| 216 see RFC5092. | |
| 217 | |
| 218 .IP SCP | |
| 219 The path part of a SCP request specifies the file to retrieve and from what | |
| 220 directory. The file part may not be omitted. The file is taken as an absolute | |
| 221 path from the root directory on the server. To specify a path relative to the | |
| 222 user's home directory on the server, prepend ~/ to the path portion. If the | |
| 223 user name is not embedded in the URL, it can be set with the | |
| 224 \fICURLOPT_USERPWD(3)\fP or \fICURLOPT_USERNAME(3)\fP option. | |
| 225 | |
| 226 scp://user@example.com/etc/issue - This specifies the file /etc/issue | |
| 227 | |
| 228 scp://example.com/~/my-file - This specifies the file my-file in the | |
| 229 user's home directory on the server | |
| 230 | |
| 231 .IP SFTP | |
| 232 The path part of a SFTP request specifies the file to retrieve and from what | |
| 233 directory. If the file part is omitted then libcurl downloads the directory | |
| 234 listing for the directory specified. If the path ends in a / then a directory | |
| 235 listing is returned instead of a file. If the path is omitted entirely then | |
| 236 the directory listing for the root / home directory will be returned. If the | |
| 237 user name is not embedded in the URL, it can be set with the | |
| 238 \fICURLOPT_USERPWD(3)\fP or \fICURLOPT_USERNAME(3)\fP option. | |
| 239 | |
| 240 sftp://user:password@example.com/etc/issue - This specifies the file | |
| 241 /etc/issue | |
| 242 | |
| 243 sftp://user@example.com/~/my-file - This specifies the file my-file in the | |
| 244 user's home directory | |
| 245 | |
| 246 sftp://ssh.example.com/~/Documents/ - This requests a directory listing | |
| 247 of the Documents directory under the user's home directory | |
| 248 | |
| 249 .IP SMB | |
| 250 The path part of a SMB request specifies the file to retrieve and from what | |
| 251 share and directory or the share to upload to and as such, may not be omitted. | |
| 252 If the user name is not embedded in the URL, it can be set with the | |
| 253 \fICURLOPT_USERPWD(3)\fP or \fICURLOPT_USERNAME(3)\fP option. If the user name | |
| 254 is embedded in the URL then it must contain the domain name and as such, the | |
| 255 backslash must be URL encoded as %2f. | |
| 256 | |
| 257 smb://server.example.com/files/issue - This specifies the file "issue" located | |
| 258 in the root of the "files" share | |
| 259 | |
| 260 smb://server.example.com/files/ -T issue - This specifies the file "issue" will | |
| 261 be uploaded to the root of the "files" share. | |
| 262 | |
| 263 .IP LDAP | |
| 264 The path part of a LDAP request can be used to specify the: Distinguished | |
| 265 Name, Attributes, Scope, Filter and Extension for a LDAP search. Each field | |
| 266 is separated by a question mark and when that field is not required an empty | |
| 267 string with the question mark separator should be included. | |
| 268 | |
| 269 ldap://ldap.example.com/o=My%20Organisation - This will perform a LDAP search | |
| 270 with the DN as My Organisation. | |
| 271 | |
| 272 ldap://ldap.example.com/o=My%20Organisation?postalAddress - This will perform | |
| 273 the same search but will only return postalAddress attributes. | |
| 274 | |
| 275 ldap://ldap.example.com/?rootDomainNamingContext - This specifies an empty DN | |
| 276 and requests information about the rootDomainNamingContext attribute for an | |
| 277 Active Directory server. | |
| 278 | |
| 279 For more information about the individual components of a LDAP URL please | |
| 280 see RFC4516. | |
| 281 .IP RTMP | |
| 282 There's no official URL spec for RTMP so libcurl uses the URL syntax supported | |
| 283 by the underlying librtmp library. It has a syntax where it wants a | |
| 284 traditional URL, followed by a space and a series of space-separated | |
| 285 name=value pairs. | |
| 286 | |
| 287 While space is not typically a "legal" letter, libcurl accepts them. When a | |
| 288 user wants to pass in a '#' (hash) character it will be treated as a fragment | |
| 289 and get cut off by libcurl if provided literally. You will instead have to | |
| 290 escape it by providing it as backslash and its ASCII value in hexadecimal: | |
| 291 "\\23". | |
| 292 | |
| 293 .RS 0 | |
| 294 The application does not have to keep the string around after setting this | |
| 295 option. | |
| 296 .SH ENCODING | |
| 297 The string pointed to in the \fICURLOPT_URL(3)\fP argument is generally | |
| 298 expected to be a sequence of characters using an ASCII compatible encoding. | |
| 299 | |
| 300 If libcurl is built with IDN support, the server name part of the URL can use | |
| 301 an "international name" by using the current encoding (according to locale) or | |
| 302 UTF-8 (when winidn is used). | |
| 303 | |
| 304 If libcurl is built without IDN support, the server name is used exactly as | |
| 305 specified when passed to the name resolver functions. | |
| 306 .SH DEFAULT | |
| 307 There is no default URL. If this option isn't set, no transfer can be | |
| 308 performed. | |
| 309 .SH SECURITY CONCERNS | |
| 310 Applications may at times find it convenient to allow users to specify URLs | |
| 311 for various purposes and that string would then end up fed to this option. | |
| 312 | |
| 313 Getting a URL from an external untrusted party will bring reasons for several | |
| 314 security concerns: | |
| 315 | |
| 316 If you have an application that runs as or in a server application, getting an | |
| 317 unfiltered URL can easily trick your application to access a local resource | |
| 318 instead of a remote. Protecting yourself against localhost accesses is very | |
| 319 hard when accepting user provided URLs. | |
| 320 | |
| 321 Such custom URLs can also access other ports than you planned as port numbers | |
| 322 are part of the regular URL format. The combination of a local host and a | |
| 323 custom port number can allow external users to play tricks with your local | |
| 324 services. | |
| 325 | |
| 326 Accepting external URLs may also use other protocols than http:// or other | |
| 327 common ones. Restrict what accept with \fICURLOPT_PROTOCOLS(3)\fP. | |
| 328 | |
| 329 User provided URLs can also be made to point to sites that redirect further on | |
| 330 (possibly to other protocols too). Consider your | |
| 331 \fICURLOPT_FOLLOWLOCATION(3)\fP and \fICURLOPT_REDIR_PROTOCOLS(3)\fP settings. | |
| 332 .SH PROTOCOLS | |
| 333 All | |
| 334 .SH EXAMPLE | |
| 335 .nf | |
| 336 CURL *curl = curl_easy_init(); | |
| 337 if(curl) { | |
| 338 curl_easy_setopt(curl, CURLOPT_URL, "http://example.com"); | |
| 339 | |
| 340 curl_easy_perform(curl); | |
| 341 } | |
| 342 .fi | |
| 343 .SH AVAILABILITY | |
| 344 POP3 and SMTP were added in 7.31.0 | |
| 345 .SH RETURN VALUE | |
| 346 Returns CURLE_OK on success or CURLE_OUT_OF_MEMORY if there was insufficient | |
| 347 heap space. | |
| 348 | |
| 349 Note that \fIcurl_easy_setopt(3)\fP won't actually parse the given string so | |
| 350 given a bad URL, it will not be detected until \fIcurl_easy_perform(3)\fP or | |
| 351 similar is called. | |
| 352 .SH "SEE ALSO" | |
| 353 .BR CURLOPT_VERBOSE "(3), " CURLOPT_PROTOCOLS "(3), " | |
| 354 .BR CURLOPT_FORBID_REUSE "(3), " CURLOPT_FRESH_CONNECT "(3), " | |
| 355 .BR curl_easy_perform "(3), " | |
| 356 .BR CURLINFO_REDIRECT_URL "(3), " CURLOPT_PATH_AS_IS "(3), " CURLOPT_CURLU "(3), " |
