Skip to content

Commit

Permalink
use filename, not file name
Browse files Browse the repository at this point in the history
  • Loading branch information
bagder committed Dec 15, 2023
1 parent f1ff0cf commit 733aa12
Show file tree
Hide file tree
Showing 19 changed files with 54 additions and 54 deletions.
2 changes: 1 addition & 1 deletion SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
* [What exactly is downloading?](usingcurl/downloads/whatis.md)
* [Storing downloads](usingcurl/downloads/storing.md)
* [Download to a file named by the URL](usingcurl/downloads/url-named.md)
* [Use the target file name from the server](usingcurl/downloads/content-disp.md)
* [Use the target filename from the server](usingcurl/downloads/content-disp.md)
* [HTML and charsets](usingcurl/downloads/charsets.md)
* [Compression](usingcurl/downloads/compression.md)
* [Shell redirects](usingcurl/downloads/redirects.md)
Expand Down
2 changes: 1 addition & 1 deletion cmdline/configfile.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ You tell curl to read more command-line options from a specific file with the

curl -K cmdline.txt http://example.com

…and in the `cmdline.txt` file (which, of course, can use any file name you
…and in the `cmdline.txt` file (which, of course, can use any filename you
please) you enter each command line per line:

# this is a comment, we ask to follow redirects
Expand Down
6 changes: 3 additions & 3 deletions cmdline/globbing.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,12 @@ both the web server and the mail server:

In all the globbing examples previously in this chapter we have selected to
use the `-O / --remote-name` option, which makes curl save the target file
using the file name part of the used URL.
using the filename part of the used URL.

Sometimes that is not enough. You are downloading multiple files and maybe you
want to save them in a different subdirectory or create the saved file names
want to save them in a different subdirectory or create the saved filenames
differently. curl, of course, has a solution for these situations as well:
output file name variables.
output filename variables.

Each "glob" used in a URL gets a separate variable. They are referenced as
`#[num]` - that means the single character `#` followed by the glob number
Expand Down
6 changes: 3 additions & 3 deletions ftp/upload.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# Uploading with FTP

To upload to an FTP server, you specify the entire target file path and name
in the URL, and you specify the local file name to upload with `-T,
in the URL, and you specify the local filename to upload with `-T,
--upload-file`. Optionally, you end the target URL with a slash and then the
file component from the local path will be appended by curl and used as the
remote file name.
remote filename.

Like:

curl -T localfile ftp://ftp.example.com/dir/path/remote-file

or to use the local file name as the remote name:
or to use the local filename as the remote name:

curl -T localfile ftp://ftp.example.com/dir/path/

Expand Down
2 changes: 1 addition & 1 deletion http/multipart.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ When the input type is set to a "file", like in:

<input type="file" name="image">

You provide a file for this part by specifying the file name and use `@` and
You provide a file for this part by specifying the filename and use `@` and
the path to the file to include:

curl -F [email protected] https://example.com/
Expand Down
4 changes: 2 additions & 2 deletions http/post/simple.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ also be written like this:
curl -d name=admin -d shoesize=12 http://example.com/

If the amount of data to send is too large for a mere string on the
command line, you can also read it from a file name in standard curl style:
command line, you can also read it from a filename in standard curl style:

curl -d @filename http://example.com

Expand All @@ -23,7 +23,7 @@ curl does not encode or change the data you tell it to send. **curl sends
exactly the bytes you give it**.

To send a POST body that starts with a `@` symbol, to avoid that curl tries to
load that as a file name, use `--data-raw` instead. This option has no file
load that as a filename, use `--data-raw` instead. This option has no file
loading capability:

curl --data-raw '@string' https://example.com
Expand Down
8 changes: 4 additions & 4 deletions libcurl-http/cookies.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ There are two ways to switch on the cookie engine:

### Enable cookie engine with reading

Ask libcurl to import cookies into the easy handle from a given file name with
Ask libcurl to import cookies into the easy handle from a given filename with
the `CURLOPT_COOKIEFILE` option:

curl_easy_setopt(easy, CURLOPT_COOKIEFILE, "cookies.txt");

A common trick is to just specify a non-existing file name or plain "" to have
A common trick is to just specify a non-existing filename or plain "" to have
it just activate the cookie engine with a blank cookie store to start with.

This option can be set multiple times and then each of the given files will be
Expand Down Expand Up @@ -113,12 +113,12 @@ Erase all session cookies (cookies without expiry date) from memory:

curl_easy_setopt(curl, CURLOPT_COOKIELIST, "SESS");

Force a write of all cookies to the file name previously specified with
Force a write of all cookies to the filename previously specified with
`CURLOPT_COOKIEJAR`:

curl_easy_setopt(curl, CURLOPT_COOKIELIST, "FLUSH");

Force a reload of cookies from the file name previously specified with
Force a reload of cookies from the filename previously specified with
`CURLOPT_COOKIEFILE`:

curl_easy_setopt(curl, CURLOPT_COOKIELIST, "RELOAD");
Expand Down
4 changes: 2 additions & 2 deletions libcurl-http/hsts.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ be used, but `CURLHSTS_ENABLE` is the primary one. If that is set, then this
easy handle how has HSTS support enabled.

The second flag available for this option is `CURLHSTS_READONLYFILE`, which if
set, tells libcurl that the file name you specify for it to use as a HSTS
set, tells libcurl that the filename you specify for it to use as a HSTS
cache is only to be read from, and not write anything back to.

## Set a HSTS cache file

If you want to persist the HSTS cache on disk, then set a file name with the
If you want to persist the HSTS cache on disk, then set a filename with the
`CURLOPT_HSTS` option. libcurl will read from this file at start of a transfer
and write to it (unless it was set read-only) when the easy handle is closed.
4 changes: 2 additions & 2 deletions libcurl/callbacks/ftpmatch.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

libcurl supports FTP wildcard matching. You use this feature by setting
`CURLOPT_WILDCARDMATCH` to `1L` and then use a "wildcard pattern" in the in
the file name part of the URL.
the filename part of the URL.

## Wildcard patterns

Expand Down Expand Up @@ -42,7 +42,7 @@ alpha, digit, print, upper, blank, graph, xdigit.

`[\\[\\]\\\\]` - escape syntax. Matches `[`, `]` or `\\`.

Using the rules above, a file name pattern can be constructed:
Using the rules above, a filename pattern can be constructed:

ftp://example.com/some/path/[a-z[:upper:]\\\\].jpeg

Expand Down
12 changes: 6 additions & 6 deletions libcurl/options/all.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This is a table of a complete list of all available options for
| `CURLOPT_ACCEPTTIMEOUT_MS` | timeout waiting for FTP server to connect back |
| `CURLOPT_ACCEPT_ENCODING` | automatic decompression of HTTP downloads |
| `CURLOPT_ADDRESS_SCOPE` | scope id for IPv6 addresses |
| `CURLOPT_ALTSVC` | alt-svc cache file name |
| `CURLOPT_ALTSVC` | alt-svc cache filename |
| `CURLOPT_ALTSVC_CTRL` | control alt-svc behavior |
| `CURLOPT_APPEND` | append to the remote file |
| `CURLOPT_AUTOREFERER` | automatically update the referer header |
Expand All @@ -33,8 +33,8 @@ This is a table of a complete list of all available options for
| `CURLOPT_CONV_FROM_UTF8_FUNCTION` | convert data from UTF8 to host encoding |
| `CURLOPT_CONV_TO_NETWORK_FUNCTION` | convert data to network from host encoding |
| `CURLOPT_COOKIE` | HTTP Cookie header |
| `CURLOPT_COOKIEFILE` | file name to read cookies from |
| `CURLOPT_COOKIEJAR` | file name to store cookies to |
| `CURLOPT_COOKIEFILE` | filename to read cookies from |
| `CURLOPT_COOKIEJAR` | filename to store cookies to |
| `CURLOPT_COOKIELIST` | add to or manipulate cookies held in memory |
| `CURLOPT_COOKIESESSION` | start a new cookie session |
| `CURLOPT_COPYPOSTFIELDS` | have libcurl copy data to POST |
Expand Down Expand Up @@ -87,7 +87,7 @@ This is a table of a complete list of all available options for
| `CURLOPT_HEADERDATA` | pointer to pass to header callback |
| `CURLOPT_HEADERFUNCTION` | callback that receives header data |
| `CURLOPT_HEADEROPT` | send HTTP headers to both proxy and host or separately |
| `CURLOPT_HSTS` | HSTS cache file name |
| `CURLOPT_HSTS` | HSTS cache filename |
| `CURLOPT_HSTSREADDATA` | pointer passed to the HSTS read callback |
| `CURLOPT_HSTSREADFUNCTION` | read callback for HSTS hosts |
| `CURLOPT_HSTSWRITEDATA` | pointer passed to the HSTS write callback |
Expand Down Expand Up @@ -137,7 +137,7 @@ This is a table of a complete list of all available options for
| `CURLOPT_MIMEPOST` | send data from mime structure |
| `CURLOPT_MIME_OPTIONS` | set MIME option flags |
| `CURLOPT_NETRC` | enable use of .netrc |
| `CURLOPT_NETRC_FILE` | file name to read .netrc info from |
| `CURLOPT_NETRC_FILE` | filename to read .netrc info from |
| `CURLOPT_NEW_DIRECTORY_PERMS` | permissions for remotely created directories |
| `CURLOPT_NEW_FILE_PERMS` | permissions for remotely created files |
| `CURLOPT_NOBODY` | do the download request without getting the body |
Expand Down Expand Up @@ -235,7 +235,7 @@ This is a table of a complete list of all available options for
| `CURLOPT_SSH_HOST_PUBLIC_KEY_SHA256` | SHA256 hash of SSH server public key |
| `CURLOPT_SSH_KEYDATA` | pointer passed to the SSH key callback |
| `CURLOPT_SSH_KEYFUNCTION` | callback for known host matching logic |
| `CURLOPT_SSH_KNOWNHOSTS` | file name holding the SSH known hosts |
| `CURLOPT_SSH_KNOWNHOSTS` | filename holding the SSH known hosts |
| `CURLOPT_SSH_PRIVATE_KEYFILE` | private key file for SSH auth |
| `CURLOPT_SSH_PUBLIC_KEYFILE` | public key file for SSH auth |
| `CURLOPT_SSLCERT` | SSL client certificate |
Expand Down
2 changes: 1 addition & 1 deletion usingcurl/downloads.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ specific data pointed to by a URL onto your machine.
* [What exactly is downloading?](downloads/whatis.md)
* [Storing downloads](downloads/storing.md)
* [Download to a file named by the URL](downloads/url-named.md)
* [Use the target file name from the server](downloads/content-disp.md)
* [Use the target filename from the server](downloads/content-disp.md)
* [HTML and charsets](downloads/charsets.md)
* [Compression](downloads/compression.md)
* [Shell redirects](downloads/redirects.md)
Expand Down
16 changes: 8 additions & 8 deletions usingcurl/downloads/content-disp.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
# Use the target file name from the server
# Use the target filename from the server

HTTP servers have the option to provide a header named `Content-Disposition:`
in responses. That header may contain a suggested file name for the contents
in responses. That header may contain a suggested filename for the contents
delivered, and curl can be told to use that hint to name its local file. The
`-J / --remote-header-name` enables this. If you also use the `-O` option,
it makes curl use the file name from the URL by default and only *if*
it makes curl use the filename from the URL by default and only *if*
there is actually a valid Content-Disposition header available, it switches to
saving using that name.

`-J` has some problems and risks associated with it that users need to be
aware of:

1. It will only use the rightmost part of the suggested file name, so any path
1. It will only use the rightmost part of the suggested filename, so any path
or directories the server suggests will be stripped out.

2. Since the file name is entirely selected by the server, curl will, of
2. Since the filename is entirely selected by the server, curl will, of
course, overwrite any preexisting local file in your current directory if the
server happens to provide such a file name.
server happens to provide such a filename.

3. File name encoding and character sets issues. curl does not decode the name
in any way, so you may end up with a URL-encoded file name where a browser
3. filename encoding and character sets issues. curl does not decode the name
in any way, so you may end up with a URL-encoded filename where a browser
would otherwise decode it to something more readable using a sensible
character set.

2 changes: 1 addition & 1 deletion usingcurl/downloads/resume.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ curl supports resumed downloads on several protocols. Tell it where to start
the transfer with the `-C, --continue-at` option that takes either a plain
numerical byte counter offset where to start or the string `-` that asks curl
to figure it out itself based on what it knows. When using `-`, curl will use
the destination file name to figure out how much data that is already present
the destination filename to figure out how much data that is already present
locally and ask use that as an offset when asking for more data from the
server.

Expand Down
8 changes: 4 additions & 4 deletions usingcurl/downloads/storing.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ something else. Outputting data to stdout is really useful when you want to
pipe it into another program or similar, but it is not always the optimal way
to deal with your downloads.

Give curl a specific file name to save the download in with `-o [filename]`
Give curl a specific filename to save the download in with `-o [filename]`
(with `--output` as the long version of the option), where filename is either
just a file name, a relative path to a file name or a full path to the file.
just a filename, a relative path to a filename or a full path to the file.

Also note that you can put the `-o` before or after the URL; it makes no
difference:
Expand All @@ -33,14 +33,14 @@ follow.

## Overwriting

When curl downloads a remote resource into a local file name as described
When curl downloads a remote resource into a local filename as described
above, it will overwrite that file in case it already existed. It will
*clobber* it.

curl offers a way to avoid this clobbering: `--no-clobber`.

When using this option, and curl finds that there already exists a file with
the given name, curl instead appends a period plus a number to the file name
the given name, curl instead appends a period plus a number to the filename
in an attempt to find a name that is not already used. It will start with `1`
and then continue trying until it reaches `100` and pick the first available
one.
Expand Down
10 changes: 5 additions & 5 deletions usingcurl/downloads/url-named.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Download to a file named by the URL

Many URLs, however, already contain the file name part in the rightmost
Many URLs, however, already contain the filename part in the rightmost
end. curl lets you use that as a shortcut so you do not have to repeat it with
`-o`. So instead of:

Expand All @@ -11,13 +11,13 @@ You can save the remote URL resource into the local file 'file.html' with this:
curl -O http://example.com/file.html

This is the `-O` (uppercase letter o) option, or `--remote-name` for the long
name version. The -O option selects the local file name to use by picking the
file name part of the URL that you provide. This is important. You specify the
name version. The -O option selects the local filename to use by picking the
filename part of the URL that you provide. This is important. You specify the
URL and curl picks the name from this data. If the site redirects curl further
(and if you tell curl to follow redirects), it does not change the file name
(and if you tell curl to follow redirects), it does not change the filename
curl will use for storing this.

## Use the URL's file name part for all URLs
## Use the URL's filename part for all URLs

As a reaction to adding a hundred `-O` options when using a hundred URLs, we
introduced an option called `--remote-name-all`. This makes `-O` the default
Expand Down
2 changes: 1 addition & 1 deletion usingcurl/tls/pinning.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ indicating its identity. A public key is extracted from this certificate and
if it does not exactly match the public key provided to this option, curl will
abort the connection before sending or receiving any data.

You tell curl a file name to read the sha256 value from, or you specify the
You tell curl a filename to read the sha256 value from, or you specify the
base64 encoded hash directly in the command line with a `sha256//` prefix. You
can specify one or more hashes like that, separated with semicolons (;).

Expand Down
6 changes: 3 additions & 3 deletions usingcurl/tls/sslkeylogfile.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ This is similarly possible to do with curl.

You do this by making the browser or curl tell Wireshark the encryption secrets so that it can decrypt them:

1. set the environment variable named `SSLKEYLOGFILE` to a file name of your choice before you start the browser or curl
2. Setting the same file name path in the Master-secret field in Wireshark. Go to Preferences->Protocols->TLS and edit the path as shown in the screenshot below.
1. set the environment variable named `SSLKEYLOGFILE` to a filename of your choice before you start the browser or curl
2. Setting the same filename path in the Master-secret field in Wireshark. Go to Preferences->Protocols->TLS and edit the path as shown in the screenshot below.

![set the ssl key file name](wireshark-ssl-master-secret.png)
![set the ssl key filename](wireshark-ssl-master-secret.png)

Having done this simple operation, you can now inspect curl's or your browser's HTTPS traffic in Wireshark. Just super handy and awesome.

Expand Down
8 changes: 4 additions & 4 deletions usingcurl/uploads.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ You send off an HTTP upload using the -T option with the file to upload:

Working with FTP, you get to see the remote file system you will be accessing.
You tell the server exactly in which directory you want the upload to be
placed and which file name to use. If you specify the upload URL with a
trailing slash, curl will append the locally used file name to the URL and
then that will be the file name used when stored remotely:
placed and which filename to use. If you specify the upload URL with a
trailing slash, curl will append the locally used filename to the URL and
then that will be the filename used when stored remotely:

curl -T uploadthis ftp://example.com/this/directory/

So if you prefer to select a different file name on the remote side than what
So if you prefer to select a different filename on the remote side than what
you have used locally, you specify it in the URL:

curl -T uploadthis ftp://example.com/this/directory/remotename
Expand Down
4 changes: 2 additions & 2 deletions usingcurl/verbose/trace.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ tcpdump) will not be able to do this job as easily for you.

For this, curl offers two other options that you use instead of `-v`.

`--trace [filename]` will save a full trace in the given file name. You can
also use '-' (a single minus) instead of a file name to get it passed to
`--trace [filename]` will save a full trace in the given filename. You can
also use '-' (a single minus) instead of a filename to get it passed to
stdout. You would use it like this:

$ curl --trace dump http://example.com
Expand Down

0 comments on commit 733aa12

Please sign in to comment.