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
- Contemporary messages sorted: [ by date ] [ by thread ] [ by subject ] [ by author ] [ by messages with attachments ]
From: Ray Satiro via curl-users <curl-users_at_cool.haxx.se>
Date: Sun, 4 Jul 2021 02:05:57 -0400
On 7/3/2021 7:27 AM, Коваленко Анатолий Викторович via curl-users wrote:
> In Windows PowerShell getting HTTP-head (parameter «-I») for TWO files (the link contains «{32,64}»)
> at one command and save the cURL report into the variable:
>
>> curl.exe -V
> curl 7.77.0 (x86_64-pc-win32) 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 libmetalink/0.1.3
> Release-Date: 2021-05-26
> Protocols: dict file ftp ftps gopher gophers http https imap imaps ldap ldaps mqtt pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
> Features: alt-svc AsynchDNS brotli gsasl HSTS HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz Metalink MultiSSL NTLM SPNEGO SSL SSPI TLS-SRP Unicode UnixSockets zstd
>
>> $Report = curl.exe -I -w "%{JSON}""https://curl.se/windows/dl-7.77.0_2/curl-7.77.0_2-win{32,64}-mingw.zip"
>> $Report.GetType()
> IsPublic IsSerial Name BaseType
> -------- -------- ---- --------
> True True Object[] System.Array
>
>> $Report.Length
> 45
>
>> $Report[22].GetType()
> IsPublic IsSerial Name BaseType
> -------- -------- ---- --------
> True True String System.Object
>
>> $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":"192.168.1.34","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":"151.101.194.49","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":"https://curl.se/windows/dl-7.77.0_2/curl-7.77.0_2-win32-mingw.zip","url_effective":"https://curl.se/windows/dl-7.77.0_2/curl-7.77.0_2-win32-mingw.zip","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_--https://curl.se/windows/dl-7.77.0_2/curl-7.77.0_2-win64-mingw.zip
>
>
> 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_--https://curl.se/windows/dl-7.77.0_2/curl-7.77.0_2-win64-mingw.zip
>
> More shortly:
> libgsasl/1.10.0"}--_curl_--https://
>
> Can you fix it? If it is not difficult…
You can silence the separators with -s or --silent [1].
[1]: https://curl.se/docs/manpage.html#-s
-----------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-users
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2021-07-04
Date: Sun, 4 Jul 2021 02:05:57 -0400
On 7/3/2021 7:27 AM, Коваленко Анатолий Викторович via curl-users wrote:
> In Windows PowerShell getting HTTP-head (parameter «-I») for TWO files (the link contains «{32,64}»)
> at one command and save the cURL report into the variable:
>
>> curl.exe -V
> curl 7.77.0 (x86_64-pc-win32) 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 libmetalink/0.1.3
> Release-Date: 2021-05-26
> Protocols: dict file ftp ftps gopher gophers http https imap imaps ldap ldaps mqtt pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
> Features: alt-svc AsynchDNS brotli gsasl HSTS HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz Metalink MultiSSL NTLM SPNEGO SSL SSPI TLS-SRP Unicode UnixSockets zstd
>
>> $Report = curl.exe -I -w "%{JSON}""https://curl.se/windows/dl-7.77.0_2/curl-7.77.0_2-win{32,64}-mingw.zip"
>> $Report.GetType()
> IsPublic IsSerial Name BaseType
> -------- -------- ---- --------
> True True Object[] System.Array
>
>> $Report.Length
> 45
>
>> $Report[22].GetType()
> IsPublic IsSerial Name BaseType
> -------- -------- ---- --------
> True True String System.Object
>
>> $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":"192.168.1.34","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":"151.101.194.49","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":"https://curl.se/windows/dl-7.77.0_2/curl-7.77.0_2-win32-mingw.zip","url_effective":"https://curl.se/windows/dl-7.77.0_2/curl-7.77.0_2-win32-mingw.zip","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_--https://curl.se/windows/dl-7.77.0_2/curl-7.77.0_2-win64-mingw.zip
>
>
> 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_--https://curl.se/windows/dl-7.77.0_2/curl-7.77.0_2-win64-mingw.zip
>
> More shortly:
> libgsasl/1.10.0"}--_curl_--https://
>
> Can you fix it? If it is not difficult…
You can silence the separators with -s or --silent [1].
[1]: https://curl.se/docs/manpage.html#-s
-----------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-users
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2021-07-04