Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $ cat main.go
- package main
- import (
- "flag"
- "fmt"
- "io"
- "net/http"
- )
- func main() {
- read := flag.Bool("read", false, "to read or not to read")
- flag.Parse()
- resp, _ := http.Head("https://www.google.com") // only changed to .Head
- defer resp.Body.Close()
- if *read {
- io.ReadAll(resp.Body)
- }
- fmt.Print(resp.Status)
- }
- $ ./script.sh
- 2024/10/30 16:37:24 http2: Transport failed to get client conn for www.google.com:443: http2: no cached connection was available
- 2024/10/30 16:37:24 http2: Transport creating client conn 0x140001bc000 to 142.250.31.99:443
- 2024/10/30 16:37:24 http2: Transport encoding header ":authority" = "www.google.com"
- 2024/10/30 16:37:24 http2: Transport encoding header ":method" = "HEAD"
- 2024/10/30 16:37:24 http2: Transport encoding header ":path" = "/"
- 2024/10/30 16:37:24 http2: Transport encoding header ":scheme" = "https"
- 2024/10/30 16:37:24 http2: Transport encoding header "user-agent" = "Go-http-client/2.0"
- 2024/10/30 16:37:24 http2: Transport received SETTINGS len=18, settings: MAX_CONCURRENT_STREAMS=100, INITIAL_WINDOW_SIZE=1048576, MAX_HEADER_LIST_SIZE=65536
- 2024/10/30 16:37:24 http2: Transport received WINDOW_UPDATE len=4 (conn) incr=983041
- 2024/10/30 16:37:24 http2: Transport received SETTINGS flags=ACK len=0
- 2024/10/30 16:37:24 http2: Transport received HEADERS flags=END_STREAM|END_HEADERS stream=1 len=787
- 2024/10/30 16:37:24 http2: Transport received PING len=8 ping="\x00\x00\x00\x00\x00\x00\x01\xc7"
- 200 OK2024/10/30 16:37:25 http2: Transport failed to get client conn for www.google.com:443: http2: no cached connection was available
- 2024/10/30 16:37:25 http2: Transport creating client conn 0x140000ea000 to 142.250.31.99:443
- 2024/10/30 16:37:25 http2: Transport encoding header ":authority" = "www.google.com"
- 2024/10/30 16:37:25 http2: Transport encoding header ":method" = "HEAD"
- 2024/10/30 16:37:25 http2: Transport encoding header ":path" = "/"
- 2024/10/30 16:37:25 http2: Transport encoding header ":scheme" = "https"
- 2024/10/30 16:37:25 http2: Transport encoding header "user-agent" = "Go-http-client/2.0"
- 2024/10/30 16:37:25 http2: Transport received SETTINGS len=18, settings: MAX_CONCURRENT_STREAMS=100, INITIAL_WINDOW_SIZE=1048576, MAX_HEADER_LIST_SIZE=65536
- 2024/10/30 16:37:25 http2: Transport received WINDOW_UPDATE len=4 (conn) incr=983041
- 2024/10/30 16:37:25 http2: Transport received SETTINGS flags=ACK len=0
- 2024/10/30 16:37:25 http2: Transport received HEADERS flags=END_STREAM|END_HEADERS stream=1 len=787
- 2024/10/30 16:37:25 http2: Transport received PING len=8 ping="\x00\x00\x00\x00\x00\x00\x02\x18"
- 200 OK2024/10/30 16:37:25 http2: Transport failed to get client conn for www.google.com:443: http2: no cached connection was available
- 2024/10/30 16:37:25 http2: Transport creating client conn 0x140000f4000 to 142.250.31.99:443
- 2024/10/30 16:37:25 http2: Transport encoding header ":authority" = "www.google.com"
- 2024/10/30 16:37:25 http2: Transport encoding header ":method" = "HEAD"
- 2024/10/30 16:37:25 http2: Transport encoding header ":path" = "/"
- 2024/10/30 16:37:25 http2: Transport encoding header ":scheme" = "https"
- 2024/10/30 16:37:25 http2: Transport encoding header "user-agent" = "Go-http-client/2.0"
- 2024/10/30 16:37:25 http2: Transport received SETTINGS len=18, settings: MAX_CONCURRENT_STREAMS=100, INITIAL_WINDOW_SIZE=1048576, MAX_HEADER_LIST_SIZE=65536
- 2024/10/30 16:37:25 http2: Transport received WINDOW_UPDATE len=4 (conn) incr=983041
- 2024/10/30 16:37:25 http2: Transport received SETTINGS flags=ACK len=0
- 2024/10/30 16:37:25 http2: Transport received HEADERS flags=END_STREAM|END_HEADERS stream=1 len=786
- 2024/10/30 16:37:25 http2: Transport received PING len=8 ping="\x00\x00\x00\x00\x00\x00\x02n"
- 200 OK2024/10/30 16:37:26 http2: Transport failed to get client conn for www.google.com:443: http2: no cached connection was available
- 2024/10/30 16:37:26 http2: Transport creating client conn 0x1400012a000 to 142.250.31.99:443
- 2024/10/30 16:37:26 http2: Transport encoding header ":authority" = "www.google.com"
- 2024/10/30 16:37:26 http2: Transport encoding header ":method" = "HEAD"
- 2024/10/30 16:37:26 http2: Transport encoding header ":path" = "/"
- 2024/10/30 16:37:26 http2: Transport encoding header ":scheme" = "https"
- 2024/10/30 16:37:26 http2: Transport encoding header "user-agent" = "Go-http-client/2.0"
- 2024/10/30 16:37:26 http2: Transport received SETTINGS len=18, settings: MAX_CONCURRENT_STREAMS=100, INITIAL_WINDOW_SIZE=1048576, MAX_HEADER_LIST_SIZE=65536
- 2024/10/30 16:37:26 http2: Transport received WINDOW_UPDATE len=4 (conn) incr=983041
- 2024/10/30 16:37:26 http2: Transport received SETTINGS flags=ACK len=0
- 2024/10/30 16:37:26 http2: Transport received HEADERS flags=END_STREAM|END_HEADERS stream=1 len=787
- 2024/10/30 16:37:26 http2: Transport received PING len=8 ping="\x00\x00\x00\x00\x00\x00\x02\xdb"
- 200 OK2024/10/30 16:37:26 http2: Transport failed to get client conn for www.google.com:443: http2: no cached connection was available
- 2024/10/30 16:37:26 http2: Transport creating client conn 0x140000c6000 to 142.250.31.99:443
- 2024/10/30 16:37:26 http2: Transport encoding header ":authority" = "www.google.com"
- 2024/10/30 16:37:26 http2: Transport encoding header ":method" = "HEAD"
- 2024/10/30 16:37:26 http2: Transport encoding header ":path" = "/"
- 2024/10/30 16:37:26 http2: Transport encoding header ":scheme" = "https"
- 2024/10/30 16:37:26 http2: Transport encoding header "user-agent" = "Go-http-client/2.0"
- 2024/10/30 16:37:26 http2: Transport received SETTINGS len=18, settings: MAX_CONCURRENT_STREAMS=100, INITIAL_WINDOW_SIZE=1048576, MAX_HEADER_LIST_SIZE=65536
- 2024/10/30 16:37:26 http2: Transport received WINDOW_UPDATE len=4 (conn) incr=983041
- 2024/10/30 16:37:26 http2: Transport received SETTINGS flags=ACK len=0
- 2024/10/30 16:37:26 http2: Transport received HEADERS flags=END_STREAM|END_HEADERS stream=1 len=786
- 2024/10/30 16:37:26 http2: Transport received PING len=8 ping="\x00\x00\x00\x00\x00\x00\x03\xb9"
- 200 OK2024/10/30 16:37:27 http2: Transport failed to get client conn for www.google.com:443: http2: no cached connection was available
- 2024/10/30 16:37:27 http2: Transport creating client conn 0x1400023c000 to 142.250.31.99:443
- 2024/10/30 16:37:27 http2: Transport encoding header ":authority" = "www.google.com"
- 2024/10/30 16:37:27 http2: Transport encoding header ":method" = "HEAD"
- 2024/10/30 16:37:27 http2: Transport encoding header ":path" = "/"
- 2024/10/30 16:37:27 http2: Transport encoding header ":scheme" = "https"
- 2024/10/30 16:37:27 http2: Transport encoding header "user-agent" = "Go-http-client/2.0"
- 2024/10/30 16:37:27 http2: Transport received SETTINGS len=18, settings: MAX_CONCURRENT_STREAMS=100, INITIAL_WINDOW_SIZE=1048576, MAX_HEADER_LIST_SIZE=65536
- 2024/10/30 16:37:27 http2: Transport received WINDOW_UPDATE len=4 (conn) incr=983041
- 2024/10/30 16:37:27 http2: Transport received SETTINGS flags=ACK len=0
- 2024/10/30 16:37:27 http2: Transport received HEADERS flags=END_STREAM|END_HEADERS stream=1 len=783
- 2024/10/30 16:37:27 http2: Transport received PING len=8 ping="\x00\x00\x00\x00\x00\x00\x00\\"
- 200 OK2024/10/30 16:37:27 http2: Transport failed to get client conn for www.google.com:443: http2: no cached connection was available
- 2024/10/30 16:37:27 http2: Transport creating client conn 0x1400025e000 to 142.250.31.99:443
- 2024/10/30 16:37:27 http2: Transport encoding header ":authority" = "www.google.com"
- 2024/10/30 16:37:27 http2: Transport encoding header ":method" = "HEAD"
- 2024/10/30 16:37:27 http2: Transport encoding header ":path" = "/"
- 2024/10/30 16:37:27 http2: Transport encoding header ":scheme" = "https"
- 2024/10/30 16:37:27 http2: Transport encoding header "user-agent" = "Go-http-client/2.0"
- 2024/10/30 16:37:27 http2: Transport received SETTINGS len=18, settings: MAX_CONCURRENT_STREAMS=100, INITIAL_WINDOW_SIZE=1048576, MAX_HEADER_LIST_SIZE=65536
- 2024/10/30 16:37:27 http2: Transport received WINDOW_UPDATE len=4 (conn) incr=983041
- 2024/10/30 16:37:27 http2: Transport received SETTINGS flags=ACK len=0
- 2024/10/30 16:37:27 http2: Transport received HEADERS flags=END_STREAM|END_HEADERS stream=1 len=786
- 2024/10/30 16:37:27 http2: Transport received PING len=8 ping="\x00\x00\x00\x00\x00\x00\x01="
- 200 OK2024/10/30 16:37:28 http2: Transport failed to get client conn for www.google.com:443: http2: no cached connection was available
- 2024/10/30 16:37:28 http2: Transport creating client conn 0x140001bc000 to 142.250.31.99:443
- 2024/10/30 16:37:28 http2: Transport encoding header ":authority" = "www.google.com"
- 2024/10/30 16:37:28 http2: Transport encoding header ":method" = "HEAD"
- 2024/10/30 16:37:28 http2: Transport encoding header ":path" = "/"
- 2024/10/30 16:37:28 http2: Transport encoding header ":scheme" = "https"
- 2024/10/30 16:37:28 http2: Transport encoding header "user-agent" = "Go-http-client/2.0"
- 2024/10/30 16:37:28 http2: Transport received SETTINGS len=18, settings: MAX_CONCURRENT_STREAMS=100, INITIAL_WINDOW_SIZE=1048576, MAX_HEADER_LIST_SIZE=65536
- 2024/10/30 16:37:28 http2: Transport received WINDOW_UPDATE len=4 (conn) incr=983041
- 2024/10/30 16:37:28 http2: Transport received SETTINGS flags=ACK len=0
- 2024/10/30 16:37:28 http2: Transport received HEADERS flags=END_STREAM|END_HEADERS stream=1 len=784
- 2024/10/30 16:37:28 http2: Transport received PING len=8 ping="\x00\x00\x00\x00\x00\x00\x01\xd6"
- 200 OK2024/10/30 16:37:28 http2: Transport failed to get client conn for www.google.com:443: http2: no cached connection was available
- 2024/10/30 16:37:28 http2: Transport creating client conn 0x140000f4000 to 142.250.31.99:443
- 2024/10/30 16:37:28 http2: Transport encoding header ":authority" = "www.google.com"
- 2024/10/30 16:37:28 http2: Transport encoding header ":method" = "HEAD"
- 2024/10/30 16:37:28 http2: Transport encoding header ":path" = "/"
- 2024/10/30 16:37:28 http2: Transport encoding header ":scheme" = "https"
- 2024/10/30 16:37:28 http2: Transport encoding header "user-agent" = "Go-http-client/2.0"
- 2024/10/30 16:37:28 http2: Transport received SETTINGS len=18, settings: MAX_CONCURRENT_STREAMS=100, INITIAL_WINDOW_SIZE=1048576, MAX_HEADER_LIST_SIZE=65536
- 2024/10/30 16:37:28 http2: Transport received WINDOW_UPDATE len=4 (conn) incr=983041
- 2024/10/30 16:37:28 http2: Transport received SETTINGS flags=ACK len=0
- 2024/10/30 16:37:28 http2: Transport received HEADERS flags=END_STREAM|END_HEADERS stream=1 len=786
- 2024/10/30 16:37:28 http2: Transport received PING len=8 ping="\x00\x00\x00\x00\x00\x00\x03C"
- 200 OK2024/10/30 16:37:29 http2: Transport failed to get client conn for www.google.com:443: http2: no cached connection was available
- 2024/10/30 16:37:29 http2: Transport creating client conn 0x140001e6000 to 142.250.31.99:443
- 2024/10/30 16:37:29 http2: Transport encoding header ":authority" = "www.google.com"
- 2024/10/30 16:37:29 http2: Transport encoding header ":method" = "HEAD"
- 2024/10/30 16:37:29 http2: Transport encoding header ":path" = "/"
- 2024/10/30 16:37:29 http2: Transport encoding header ":scheme" = "https"
- 2024/10/30 16:37:29 http2: Transport encoding header "user-agent" = "Go-http-client/2.0"
- 2024/10/30 16:37:29 http2: Transport received SETTINGS len=18, settings: MAX_CONCURRENT_STREAMS=100, INITIAL_WINDOW_SIZE=1048576, MAX_HEADER_LIST_SIZE=65536
- 2024/10/30 16:37:29 http2: Transport received WINDOW_UPDATE len=4 (conn) incr=983041
- 2024/10/30 16:37:29 http2: Transport received SETTINGS flags=ACK len=0
- 2024/10/30 16:37:29 http2: Transport received HEADERS flags=END_STREAM|END_HEADERS stream=1 len=786
- 2024/10/30 16:37:29 http2: Transport received PING len=8 ping="\x00\x00\x00\x00\x00\x00\x03\xaf"
- 200 OK%
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement