]> git.ipfire.org Git - thirdparty/curl.git/commit
write-out.d: clarify Windows % symbol escaping
authorJay Satiro <raysatiro@yahoo.com>
Mon, 23 Jan 2023 08:44:16 +0000 (03:44 -0500)
committerJay Satiro <raysatiro@yahoo.com>
Thu, 26 Jan 2023 23:52:27 +0000 (18:52 -0500)
commitcec47daa8c2e85fd1b93789c55828c82cc0df0d4
tree27b56d41b8ab833f221e97a09848fc60a2016c45
parent6a45abfbf6c5e366b05524301e1dfeacf348be26
write-out.d: clarify Windows % symbol escaping

- Clarify that in Windows batch files the % must be escaped as %%, and
  at the command prompt it cannot be escaped which could lead to
  incorrect expansion.

Prior to this change the doc implied % must be escaped as %% in win32
always.

---

Examples showing how a write-out argument is received by curl:

If curl --write-out "%{http_code}" is executed in a batch file:
{http_code}

If curl --write-out "%%{http_code}" is executed in a batch file:
%{http_code}

If curl --write-out "%{http_code}" is executed from the command prompt:
%{http_code}

If curl --write-out "%%{http_code}" is executed from the command prompt:
%%{http_code}

At the command prompt something like "%{speed_download}%{http_code}"
would first be parsed by the command interpreter as %{speed_download}%
and would be expanded as environment variable {speed_download} if it
existed, though that's highly unlikely since Windows environment names
don't use braces.

---

Reported-by: Muhammad Hussein Ammari
Ref: https://github.com/bagder/everything-curl/pull/279

Fixes https://github.com/curl/curl/issues/10323
Closes https://github.com/curl/curl/pull/10337
docs/cmdline-opts/write-out.d