HTTP/1.1, HTTP/2 を curl –head –verbose コマンドで確認する


HTTP/1.1, HTTP/2 を curl –head –verbose コマンドで確認する方法をご紹介します。

Linux

背景 HTTP/1.1, HTTP/2 を調べたい

対象の URL が HTTP/1.1, HTTP/2 に対応してるか確認する方法を調べて

curl –head –verbose, curl -I -v で確認できる

curl --head --verbose https://example.com
curl -I -v https://example.com

curl –head –verbose 実行例

$ curl --head --verbose https://example.com

*   Trying 93.184.216.34...
* TCP_NODELAY set
* Connected to example.com (93.184.216.34) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
*   CAfile: /etc/ssl/cert.pem
  CApath: none
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256
* ALPN, server accepted to use h2
* Server certificate:
*  subject: C=US; ST=California; L=Los Angeles; O=Internet Corporation for Assigned Names and Numbers; CN=www.example.org
*  start date: Nov 24 00:00:00 2020 GMT
*  expire date: Dec 25 23:59:59 2021 GMT
*  subjectAltName: host "example.com" matched cert's "example.com"
*  issuer: C=US; O=DigiCert Inc; CN=DigiCert TLS RSA SHA256 2020 CA1
*  SSL certificate verify ok.
* Using HTTP2, server supports multi-use
* 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 0x7ff1fb80dc00)
> HEAD / HTTP/2
> Host: example.com
> User-Agent: curl/7.64.1
> Accept: */*
> 
* Connection state changed (MAX_CONCURRENT_STREAMS == 100)!
< HTTP/2 200 
HTTP/2 200 
< content-encoding: gzip
content-encoding: gzip
< accept-ranges: bytes
accept-ranges: bytes
< age: 547174
age: 547174
< cache-control: max-age=604800
cache-control: max-age=604800
< content-type: text/html; charset=UTF-8
content-type: text/html; charset=UTF-8
< date: Sat, 05 Jun 2021 00:49:50 GMT
date: Sat, 05 Jun 2021 00:49:50 GMT
< etag: "3147526947+gzip"
etag: "3147526947+gzip"
< expires: Sat, 12 Jun 2021 00:49:50 GMT
expires: Sat, 12 Jun 2021 00:49:50 GMT
< last-modified: Thu, 17 Oct 2019 07:18:26 GMT
last-modified: Thu, 17 Oct 2019 07:18:26 GMT
< server: ECS (nyb/1D0F)
server: ECS (nyb/1D0F)
< x-cache: HIT
x-cache: HIT
< content-length: 648
content-length: 648

< 
* Connection #0 to host example.com left intact
* Closing connection 0

以上、HTTP/1.1, HTTP/2 を curl --head --verbose コマンドで確認した、現場からお送りしました。

  1. コメントはまだありません。

  1. トラックバックはまだありません。