write-out.d 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. c: Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
  2. SPDX-License-Identifier: curl
  3. Long: write-out
  4. Short: w
  5. Arg: <format>
  6. Help: Use output FORMAT after completion
  7. Category: verbose
  8. Example: -w '%{http_code}\\n' $URL
  9. Added: 6.5
  10. See-also: verbose head
  11. Multi: single
  12. ---
  13. Make curl display information on stdout after a completed transfer. The format
  14. is a string that may contain plain text mixed with any number of
  15. variables. The format can be specified as a literal "string", or you can have
  16. curl read the format from a file with "@filename" and to tell curl to read the
  17. format from stdin you write "@-".
  18. The variables present in the output format will be substituted by the value or
  19. text that curl thinks fit, as described below. All variables are specified as
  20. %{variable_name} and to output a normal % you just write them as %%. You can
  21. output a newline by using \\n, a carriage return with \\r and a tab space with
  22. \\t.
  23. The output will be written to standard output, but this can be switched to
  24. standard error by using %{stderr}.
  25. Output HTTP headers from the most recent request by using \fB%header{name}\fP
  26. where \fBname\fP is the case insensitive name of the header (without the
  27. trailing colon). The header contents are exactly as sent over the network,
  28. with leading and trailing whitespace trimmed. Added in curl 7.84.0.
  29. .B NOTE:
  30. The %-symbol is a special symbol in the win32-environment, where all
  31. occurrences of % must be doubled when using this option.
  32. The variables available are:
  33. .RS
  34. .TP 15
  35. .B content_type
  36. The Content-Type of the requested document, if there was any.
  37. .TP
  38. .B errormsg
  39. The error message. (Added in 7.75.0)
  40. .TP
  41. .B exitcode
  42. The numerical exitcode of the transfer. (Added in 7.75.0)
  43. .TP
  44. .B filename_effective
  45. The ultimate filename that curl writes out to. This is only meaningful if curl
  46. is told to write to a file with the --remote-name or --output
  47. option. It's most useful in combination with the --remote-header-name
  48. option. (Added in 7.26.0)
  49. .TP
  50. .B ftp_entry_path
  51. The initial path curl ended up in when logging on to the remote FTP
  52. server. (Added in 7.15.4)
  53. .TP
  54. .B header_json
  55. A JSON object with all HTTP response headers from the recent transfer. Values
  56. are provided as arrays, since in the case of multiple headers there can be
  57. multiple values.
  58. The header names provided in lowercase, listed in order of appearance over the
  59. wire. Except for duplicated headers. They are grouped on the first occurrence
  60. of that header, each value is presented in the JSON array.
  61. .TP
  62. .B http_code
  63. The numerical response code that was found in the last retrieved HTTP(S) or
  64. FTP(s) transfer.
  65. .TP
  66. .B http_connect
  67. The numerical code that was found in the last response (from a proxy) to a
  68. curl CONNECT request. (Added in 7.12.4)
  69. .TP
  70. .B http_version
  71. The http version that was effectively used. (Added in 7.50.0)
  72. .TP
  73. .B json
  74. A JSON object with all available keys.
  75. .TP
  76. .B local_ip
  77. The IP address of the local end of the most recently done connection - can be
  78. either IPv4 or IPv6. (Added in 7.29.0)
  79. .TP
  80. .B local_port
  81. The local port number of the most recently done connection. (Added in 7.29.0)
  82. .TP
  83. .B method
  84. The http method used in the most recent HTTP request. (Added in 7.72.0)
  85. .TP
  86. .B num_connects
  87. Number of new connects made in the recent transfer. (Added in 7.12.3)
  88. .TP
  89. .B num_headers
  90. The number of response headers in the most recent request (restarted at each
  91. redirect). Note that the status line IS NOT a header. (Added in 7.73.0)
  92. .TP
  93. .B num_redirects
  94. Number of redirects that were followed in the request. (Added in 7.12.3)
  95. .TP
  96. .B onerror
  97. The rest of the output is only shown if the transfer returned a non-zero error
  98. (Added in 7.75.0)
  99. .TP
  100. .B proxy_ssl_verify_result
  101. The result of the HTTPS proxy's SSL peer certificate verification that was
  102. requested. 0 means the verification was successful. (Added in 7.52.0)
  103. .TP
  104. .B redirect_url
  105. When an HTTP request was made without --location to follow redirects (or when
  106. --max-redirs is met), this variable will show the actual URL a redirect
  107. *would* have gone to. (Added in 7.18.2)
  108. .TP
  109. .B referer
  110. The Referer: header, if there was any. (Added in 7.76.0)
  111. .TP
  112. .B remote_ip
  113. The remote IP address of the most recently done connection - can be either
  114. IPv4 or IPv6. (Added in 7.29.0)
  115. .TP
  116. .B remote_port
  117. The remote port number of the most recently done connection. (Added in 7.29.0)
  118. .TP
  119. .B response_code
  120. The numerical response code that was found in the last transfer (formerly
  121. known as "http_code"). (Added in 7.18.2)
  122. .TP
  123. .B scheme
  124. The URL scheme (sometimes called protocol) that was effectively used. (Added in 7.52.0)
  125. .TP
  126. .B size_download
  127. The total amount of bytes that were downloaded. This is the size of the
  128. body/data that was transferred, excluding headers.
  129. .TP
  130. .B size_header
  131. The total amount of bytes of the downloaded headers.
  132. .TP
  133. .B size_request
  134. The total amount of bytes that were sent in the HTTP request.
  135. .TP
  136. .B size_upload
  137. The total amount of bytes that were uploaded. This is the size of the
  138. body/data that was transferred, excluding headers.
  139. .TP
  140. .B speed_download
  141. The average download speed that curl measured for the complete download. Bytes
  142. per second.
  143. .TP
  144. .B speed_upload
  145. The average upload speed that curl measured for the complete upload. Bytes per
  146. second.
  147. .TP
  148. .B ssl_verify_result
  149. The result of the SSL peer certificate verification that was requested. 0
  150. means the verification was successful. (Added in 7.19.0)
  151. .TP
  152. .B stderr
  153. From this point on, the --write-out output will be written to standard
  154. error. (Added in 7.63.0)
  155. .TP
  156. .B stdout
  157. From this point on, the --write-out output will be written to standard output.
  158. This is the default, but can be used to switch back after switching to stderr.
  159. (Added in 7.63.0)
  160. .TP
  161. .B time_appconnect
  162. The time, in seconds, it took from the start until the SSL/SSH/etc
  163. connect/handshake to the remote host was completed. (Added in 7.19.0)
  164. .TP
  165. .B time_connect
  166. The time, in seconds, it took from the start until the TCP connect to the
  167. remote host (or proxy) was completed.
  168. .TP
  169. .B time_namelookup
  170. The time, in seconds, it took from the start until the name resolving was
  171. completed.
  172. .TP
  173. .B time_pretransfer
  174. The time, in seconds, it took from the start until the file transfer was just
  175. about to begin. This includes all pre-transfer commands and negotiations that
  176. are specific to the particular protocol(s) involved.
  177. .TP
  178. .B time_redirect
  179. The time, in seconds, it took for all redirection steps including name lookup,
  180. connect, pretransfer and transfer before the final transaction was
  181. started. time_redirect shows the complete execution time for multiple
  182. redirections. (Added in 7.12.3)
  183. .TP
  184. .B time_starttransfer
  185. The time, in seconds, it took from the start until the first byte was just
  186. about to be transferred. This includes time_pretransfer and also the time the
  187. server needed to calculate the result.
  188. .TP
  189. .B time_total
  190. The total time, in seconds, that the full operation lasted.
  191. .TP
  192. .B url
  193. The URL that was fetched. (Added in 7.75.0)
  194. .TP
  195. .B urlnum
  196. The URL index number of this transfer, 0-indexed. De-globbed URLs share the
  197. same index number as the origin globbed URL. (Added in 7.75.0)
  198. .TP
  199. .B url_effective
  200. The URL that was fetched last. This is most meaningful if you have told curl
  201. to follow location: headers.
  202. .RE
  203. .IP