curl / Mailing Lists / curl-users / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Re: -w "%{JSON}" at multiple links in PowerShell

From: Jeremy Nicoll via curl-users <>
Date: Sun, 04 Jul 2021 10:27:36 +0100

On Sun, 4 Jul 2021, at 07:05, Ray Satiro via curl-users wrote:
> On 7/3/2021 7:27 AM, Коваленко Анатолий Викторович via curl-users wrote:


Presuming that this shows the whole of the executed curl command (and
that there's no global options set anywhere that affect it):

> >> $Report = curl.exe -I -w "%{JSON}" "{32,64}" <,>


> >> $Report[22]
> > {"content_type":"application/zip","errormsg":null,"exitcode":0,"filename_effective":null,"ftp_entry_path":null,"http_code":200,"http_connect":0,"http_version":"2","local_ip":"","local_port":30394,"method":"HEAD","num_connects":1,"num_headers":19,"num_redirects":0,"proxy_ssl_verify_result":0,"redirect_url":null,"referer":null,"remote_ip":"","remote_port":443,"response_code":200,"scheme":"HTTPS","size_download":0,"size_header":729,"size_request":119,"size_upload":0,"speed_download":0,"speed_upload":0,"ssl_verify_result":0,"time_appconnect":0.333912,"time_connect":0.159824,"time_namelookup":0.075124,"time_pretransfer":0.349545,"time_redirect":0.000000,"time_starttransfer":0.417440,"time_total":0.417559,"url":"","url_effective":"","urlnum":0,"curl_version":"libcurl/7.77.0 OpenSSL/1.1.1k (Schannel) zlib/1.2.11 brotli/1.0.9!
  zstd/1.5.0 libidn2/2.3.1 libssh2/1.9.0 nghttp2/1.43.0 libgsasl/1.10.0"}--_curl_--
> >
> >
> > You can see, that the head (or the start) of output for the second file in the value of the string
> > «$Report[22]» is clear connected to tail (or the end) of output for the first file WITHOUT new line:
> > "curl_version":"libcurl/7.77.0 OpenSSL/1.1.1k (Schannel) zlib/1.2.11 brotli/1.0.9 zstd/1.5.0 libidn2/2.3.1 libssh2/1.9.0 nghttp2/1.43.0 libgsasl/1.10.0"}--_curl_--
> You can silence the separators with -s or --silent [1].

I don't think the OP is asking for a way to turn-off separators, but instead
asking why there isn't one between the end of the first file's headers, and
the start of the next file's headers.

Also, I don't see anything that says it affects separators between parts of
the output, in the man page about -s:

-s, --silent

  Silent or quiet mode. Don't show progress meter or error messages. Makes Curl mute.
  It will still output the data you ask for, potentially even to the terminal/stdout unless you
  redirect it.

  Use -S, --show-error in addition to this option to disable progress meter but still show
  error messages.

  See also -v, --verbose, --stderr and --no-progress-meter.

Am I misunderstanding the issue?

Jeremy Nicoll - my opinions are my own.
Received on 2021-07-04