Difference between revisions of "Curl -v"

From wikieduonline
Jump to navigation Jump to search
 
(9 intermediate revisions by the same user not shown)
Line 24: Line 24:
  
 
== Example ==
 
== Example ==
[[curl]] -v https://google.com
+
=== [[curl]] -v https://google.com connection ===
  
 
  *  Trying 172.217.18.110:443...
 
  *  Trying 172.217.18.110:443...
Line 40: Line 40:
 
  * (304) (IN), TLS handshake, Finished (20):
 
  * (304) (IN), TLS handshake, Finished (20):
 
  * (304) (OUT), TLS handshake, Finished (20):
 
  * (304) (OUT), TLS handshake, Finished (20):
  * SSL connection using TLSv1.3 / AEAD-CHACHA20-POLY1305-SHA256
+
  * SSL connection using [[TLSv1.3]] / AEAD-CHACHA20-POLY1305-SHA256
 
  * ALPN, server accepted to use h2
 
  * ALPN, server accepted to use h2
<pre>
+
* Server certificate:
* Server certificate:
+
*  subject: CN=*.google.com
*  subject: CN=*.google.com
+
*  start date: Aug  1 08:18:00 2022 GMT
*  start date: Aug  1 08:18:00 2022 GMT
+
*  expire date: Oct 24 08:17:59 2022 GMT
*  expire date: Oct 24 08:17:59 2022 GMT
+
*  subjectAltName: host "google.com" matched cert's "google.com"
*  subjectAltName: host "google.com" matched cert's "google.com"
+
*  issuer: C=US; O=Google Trust Services LLC; CN=GTS CA 1C3
*  issuer: C=US; O=Google Trust Services LLC; CN=GTS CA 1C3
+
*  SSL certificate verify ok.
*  SSL certificate verify ok.
+
* Using HTTP2, server supports multiplexing
* Using HTTP2, server supports multiplexing
+
* Connection state changed (HTTP/2 confirmed)
* Connection state changed (HTTP/2 confirmed)
+
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
+
* Using Stream ID: 1 (easy handle 0x141010a00)
* Using Stream ID: 1 (easy handle 0x141010a00)
+
> GET / HTTP/2
> GET / HTTP/2
+
> Host: google.com
> Host: google.com
+
> user-agent: curl/7.79.1
> user-agent: curl/7.79.1
+
> accept: */*
> accept: */*
+
>
>
+
< HTTP/2 301
< HTTP/2 301
+
< location: https://www.google.com/
< location: https://www.google.com/
+
< content-type: text/html; charset=UTF-8
< content-type: text/html; charset=UTF-8
+
< date: Wed, 24 Aug 2022 05:08:57 GMT
< date: Wed, 24 Aug 2022 05:08:57 GMT
+
< expires: Wed, 24 Aug 2022 05:08:57 GMT
< expires: Wed, 24 Aug 2022 05:08:57 GMT
+
< cache-control: private, max-age=2592000
< cache-control: private, max-age=2592000
+
< server: gws
< server: gws
+
< content-length: 220
< content-length: 220
+
< x-xss-protection: 0
< x-xss-protection: 0
+
< x-frame-options: SAMEORIGIN
< x-frame-options: SAMEORIGIN
+
< set-cookie: CONSENT=PENDING+732; expires=Fri, 23-Aug-2024 05:08:57 GMT; path=/; domain=.google.com; Secure
< set-cookie: CONSENT=PENDING+732; expires=Fri, 23-Aug-2024 05:08:57 GMT; path=/; domain=.google.com; Secure
+
< p3p: CP="This is not a P3P policy! See g.co/p3phelp for more info."
< p3p: CP="This is not a P3P policy! See g.co/p3phelp for more info."
+
< alt-svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"
< alt-svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"
+
<
<
+
<nowiki>
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
+
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
+
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
+
<H1>301 Moved</H1>
The document has moved
+
The document has moved
<A HREF="https://www.google.com/">here</A>.
+
<A HREF="https://www.google.com/">here</A>.
</BODY></HTML>
+
</BODY></HTML>
* Connection #0 to host google.com left intact
+
* Connection #0 to host google.com left intact
</pre>
+
</nowiki>
  
 +
 +
=== curl -v https://google.com failing connection ===
 +
 +
{{curl -v failing}}
  
 
== Related ==
 
== Related ==

Latest revision as of 10:00, 9 February 2024

Examples[edit]

HTTP/1.1 200 OK[edit]

curl -v http://localhost:8545
*   Trying 127.0.0.1:8545...
* Connected to localhost (127.0.0.1) port 8545 (#0)
> GET / HTTP/1.1
> Host: localhost:8545
> User-Agent: curl/7.85.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Date: Mon, 13 Mar 2023 12:59:09 GMT
< Content-Length: 0
<
* Connection #0 to host localhost left intact

Connection refused[edit]

curl http://localhost:8533
curl: (7) Failed to connect to localhost port 8533 after 0 ms: Connection refused

Example[edit]

curl -v https://google.com connection[edit]

*   Trying 172.217.18.110:443...
* Connected to google.com (172.217.18.110) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
*  CAfile: /etc/ssl/cert.pem
*  CApath: none
* (304) (OUT), TLS handshake, Client hello (1):
* (304) (IN), TLS handshake, Server hello (2):
* (304) (IN), TLS handshake, Unknown (8):
* (304) (IN), TLS handshake, Certificate (11):
* (304) (IN), TLS handshake, CERT verify (15):
* (304) (IN), TLS handshake, Finished (20):
* (304) (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / AEAD-CHACHA20-POLY1305-SHA256
* ALPN, server accepted to use h2
* Server certificate:
*  subject: CN=*.google.com
*  start date: Aug  1 08:18:00 2022 GMT
*  expire date: Oct 24 08:17:59 2022 GMT
*  subjectAltName: host "google.com" matched cert's "google.com"
*  issuer: C=US; O=Google Trust Services LLC; CN=GTS CA 1C3
*  SSL certificate verify ok.
* Using HTTP2, server supports multiplexing
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* Using Stream ID: 1 (easy handle 0x141010a00)
> GET / HTTP/2
> Host: google.com
> user-agent: curl/7.79.1
> accept: */*
>
< HTTP/2 301
< location: https://www.google.com/
< content-type: text/html; charset=UTF-8
< date: Wed, 24 Aug 2022 05:08:57 GMT
< expires: Wed, 24 Aug 2022 05:08:57 GMT
< cache-control: private, max-age=2592000
< server: gws
< content-length: 220
< x-xss-protection: 0
< x-frame-options: SAMEORIGIN
< set-cookie: CONSENT=PENDING+732; expires=Fri, 23-Aug-2024 05:08:57 GMT; path=/; domain=.google.com; Secure
< p3p: CP="This is not a P3P policy! See g.co/p3phelp for more info."
< alt-svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"
<

 <HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
 <TITLE>301 Moved</TITLE></HEAD><BODY>
 <H1>301 Moved</H1>
 The document has moved
 <A HREF="https://www.google.com/">here</A>.
 </BODY></HTML>
 * Connection #0 to host google.com left intact
 


curl -v https://google.com failing connection[edit]

 curl -v https://google.com
 * processing: https://google.com
*   Trying 142.250.181.78:443...
* Connected to google.com (142.250.181.78) port 443
* ALPN: offers h2,http/1.1
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
*  CAfile: /etc/ssl/certs/ca-certificates.crt
*  CApath: /etc/ssl/certs
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
* TLSv1.3 (IN), TLS handshake, Certificate (11):
* TLSv1.3 (OUT), TLS alert, unknown CA (560):
* SSL certificate problem: unable to get local issuer certificate
* Closing connection
curl: (60) SSL certificate problem: unable to get local issuer certificate
More details here: https://curl.se/docs/sslcerts.html

curl failed to verify the legitimacy of the server and therefore could not
establish a secure connection to it. To learn more about this situation and
how to fix it, please visit the web page mentioned above.

Related[edit]

See also[edit]

Advertising: