Skip to content

Very simple tool to do a head request and report the time taken for each step

License

Notifications You must be signed in to change notification settings

network-plane/headview

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

headview

A powerful command-line HTTP request analyzer that performs HEAD requests and provides detailed timing information for each step of the connection process. Perfect for debugging network issues, analyzing website performance, and understanding HTTP connection behavior.

Features

  • Detailed Connection Timing: DNS lookup, TCP connection, TLS handshake, and time-to-first-byte metrics
  • Redirect Following: Automatically follows HTTP redirects with timing for each hop
  • Resource Size Analysis: Calculate total page size including all linked resources (CSS, JS, images)
  • Multiple Output Formats: Text (default), JSON, and CSV for integration with other tools
  • Concurrent Resource Fetching: Configurable concurrency for faster resource analysis
  • TLS/SSL Information: Certificate details, cipher suites, and protocol versions
  • Connection Reuse Detection: Shows when connections are reused vs. newly established
  • HTTP Protocol Detection: Automatically detects HTTP/1.1, HTTP/2, and HTTP/3

Installation

Pre-built Binaries

Download the latest release for your platform from the releases page.

From Source

git clone https://github.com/earentir/headview.git
cd headview
go build -o headview .

Using Go Install

go install github.com/earentir/headview@latest

Usage

Basic Request Analysis

headview https://example.com

Show Response Headers

headview https://example.com --headers

Analyze Page Resource Sizes

headview https://example.com --size

JSON Output for Scripting

headview https://example.com --json

CSV Output for Data Analysis

headview https://example.com --csv

High Concurrency Resource Analysis

headview https://example.com --size --concurrent 20

Sample Output

Standard Text Output

URL: https://example.com
Response status: 200 OK
Last Modified: Wed, 21 Oct 2015 07:28:00 GMT
       Content size: 1.25 KB
New connection established for this request

Connection #1
          Connection: New
       Local address: 192.168.1.100:54321
      Remote address: 93.184.216.34:443
          DNS lookup: 23.45ms
      TCP connection: 45.67ms
       TLS handshake: 89.12ms
         TLS version: TLS 1.3
          TLS cipher: TLS13-AES-128-GCM-SHA256
      TLS resumption: false
  Waiting for server: 12.34ms
  Time To First Byte: 156.78ms
            Protocol: HTTPS
        HTTP version: HTTP/2

Request
     Request sending: 1.23ms
   Server processing: 67.89ms
    Content transfer: 45.67ms
████████████████████████████ 0.16 ┼
Total request: 160.00ms

JSON Output

{
  "url": "https://example.com",
  "status_code": 200,
  "status": "200 OK",
  "content_size": 1256,
  "timings": {
    "common_timings": [
      {
        "dns_lookup_time": "23450000ns",
        "tcp_conn_time": "45670000ns",
        "tls_handshake_time": "89120000ns",
        "ttfb": "156780000ns",
        "tls_version": "TLS 1.3",
        "tls_cipher_suite": "TLS13-AES-128-GCM-SHA256",
        "connection_reused": false,
        "protocol": "HTTPS",
        "http_version": "HTTP/2"
      }
    ],
    "request_sending_time": "1230000ns",
    "server_processing_time": "67890000ns",
    "total_request_time": "160000000ns",
    "content_transfer_time": "45670000ns"
  },
  "timestamp": "2024-01-18T12:34:56Z",
  "version": "0.1.18"
}

Command Line Options

Flag Short Description
--headers Include response headers in output
--size Calculate and display sizes of all page resources
--concurrent N Maximum concurrent requests for size calculation (default: 5)
--json Output in JSON format
--csv Output in CSV format
--version -v Show version information
--help -h Show help information

Exit Codes

  • 0: Success
  • 1: General error (legacy)
  • 2: Command line argument error
  • 3: Network/HTTP error

Advanced Usage

Analyzing Redirect Chains

headview automatically follows redirects and shows timing information for each hop:

headview http://bit.ly/example

Performance Comparison

Use CSV output to compare performance across multiple sites:

for site in example.com google.com github.com; do
  headview https://$site --csv --quiet
done > performance.csv

Integration with Monitoring Tools

The JSON output makes it easy to integrate with monitoring and alerting systems:

# Check if response time exceeds threshold
response_time=$(headview https://api.example.com --json | jq '.timings.total_request_time | tonumber / 1000000')
if (( $(echo "$response_time > 1000" | bc -l) )); then
  echo "Slow response: ${response_time}ms"
  exit 1
fi

Security Considerations

  • By default, headview skips TLS certificate verification for testing purposes
  • For production monitoring, consider implementing certificate validation
  • Be mindful of rate limiting when using with high concurrency

Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Add tests for new functionality
  4. Ensure all tests pass
  5. Submit a pull request

License

This project is licensed under the GNU General Public License v2.0 - see the LICENSE file for details.

Related Projects

  • curl - Command line tool for transferring data
  • httpie - User-friendly HTTP client
  • hey - HTTP load testing tool

About

Very simple tool to do a head request and report the time taken for each step

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages