↓ Skip to main content
Security

Every packet for my HTTPS request

In one of my old posts on PKI and SSL/TLS describe what happens when you open an HTTPS page as a numbered list. I wanted to see the list happen. So I captured one request to GitHub, all 32 packets of it, and followed it down through every layer and back up again.
The 32 packets of one HTTPS request to github.com on a timeline of 167 milliseconds, in five phases: DNS lookup over loopback (0 to 31 ms), TCP three-way handshake (31 to 64 ms), TLS 1.3 handshake with the certificate chain (72 to 105 ms), the HTTP/2 HEAD request and 200 OK answer (105 to 131 ms), and the close (132 to 167 ms). Beside it, the layers each phase uses: link, internet, transport, and the application layer split into TLS and, inside it, HTTP/2 and DNS.
One request, 32 packets, 167 ms

The layers, before the packets
#

A network connection is built in layers: each one does a single job and hands the rest to the layer below. There are two well-known ways to draw them.

  • The TCP/IP model is what the internet actually runs. RFC 1122, the 1989 rulebook for internet hosts, names four layers: application, transport, internet and link (RFC 1122, section 1.1.3).
  • The OSI model is the teaching model, with seven layers, from physical up to application. It is defined in ITU-T X.200, the same text as ISO/IEC 7498-1, and the ITU gives it away free (X.200).
OSI layer (X.200)TCP/IP layer (RFC 1122)What it is in my capture
7 Application, 6 Presentation, 5 SessionApplicationDNS; HTTP/2, carried inside TLS
4 TransportTransportUDP to port 53 for DNS, TCP to port 443 for HTTPS
3 NetworkInternetIPv4: my machine to 140.82.113.4
2 Data linkLinkEthernet frames on WSL’s virtual network card
1 PhysicalLinkthe wire or radio; invisible to a capture tool

Where does TLS go? In the TCP/IP model it is part of the application layer. High Performance Browser Networking says SSL, TLS’s predecessor, “was implemented at the application layer, directly on top of TCP” (HPBN, chapter 4), and the TLS 1.3 standard says “higher-level protocols can layer on top of TLS transparently” (RFC 9846, section 1). So the application layer has two parts here: TLS at the bottom, sitting on TCP, and HTTP/2 riding inside it, unaware that it is encrypted.

OSI is older: X.200 is from 1994, and TLS 1.0 (RFC 2246) only arrived in January 1999, so it has no box named for it. But X.200 does list “agreement on security aspects (e.g. authentication, access control, data integrity)” among the facilities of the Application Layer (X.200, section 7.1.3.2), which is the same answer. In my diagram TLS gets its own row, drawn inside the application layer, because it has packets of its own in the capture.

How I captured it
#

From Linux under WSL, not Windows, because on Windows the antivirus on my machine answers every HTTPS connection itself. Two terminals:

# terminal 1: record DNS and HTTPS on both interfaces for 12 seconds
sudo tshark -f "port 53 or tcp port 443" -i lo -i eth0 -w req.pcapng -a duration:12

# terminal 2: one request, with curl writing its TLS session keys to a file
SSLKEYLOGFILE=keys.log curl -sI https://github.com/

Why those two interfaces? First I asked tshark what it can listen on. tshark -D lists every interface it can capture from, with a number you can pass to -i instead of the name (tshark manual). The first three lines on my WSL machine:

1. eth0
2. any
3. lo (Loopback)
  • eth0 is WSL’s virtual network card, the way out to the internet. The TCP, TLS and HTTP/2 packets to GitHub cross it.
  • lo, the loopback, is traffic a machine sends to itself. WSL’s DNS resolver has its address on lo (I checked the nameserver line in /etc/resolv.conf against ip addr), so the DNS packets only appear there. That’s the surprise in step 1.
  • any would capture every interface at once. I named the two I wanted instead, so each packet shows which one it crossed.

Leaving out -i would have lost the DNS: tshark then picks “the first non-loopback interface”, which here is eth0. Every argument in the two commands:

ArgumentWhat it doesWhy I used it
sudoruns tshark as rootcapturing live packets needs root on Linux
-i lo -i eth0the interfaces to capture on, by name or by the number tshark -D prints; repeat -i for more than oneDNS is on lo, GitHub traffic on eth0
-f "port 53 or tcp port 443"a capture filter: packets that don’t match are never recorded (syntax, examples)port 53 is DNS (UDP or TCP), tcp port 443 is HTTPS; everything else my machine was doing stays out. It comes before the -i options, so it applies to both
-w req.pcapngwrites the raw packets to a file instead of printing themso I could read the capture again and again, with and without the keys
-a duration:12autostop: stop writing “after value seconds have elapsed”12 seconds is enough to start curl in the other terminal
SSLKEYLOGFILE=keys.logan environment variable for curl alone: write the TLS session secrets to this fileto decrypt packets 9 onwards later
curl -ssilent: no progress meterclean output
curl -Iheaders only, no page body; on the wire it is a HEAD request, as step 4 showsfewer packets, and the post is about the exchange, not the HTML
-r req.pcapngreads packets from a file instead of a live interfacethe reading step, after the capture
-o tls.keylog_file:keys.logsets a preference for this run only; here, where the TLS key log isturns the encrypted records into readable HTTP/2

The capture filter (-f) is in “libpcap filter syntax”, as tshark -h puts it, and is applied while capturing, so filtered-out packets are never written. The full language is in the pcap-filter manual page: port 53 is true “if the source or the destination TCP/UDP/SCTP port” is 53, which is why it catches DNS over both UDP and TCP. The Wireshark User’s Guide has a short overview, and the CaptureFilters page of the Wireshark wiki is a list of ready-made ones, starting with “Capture only DNS (port 53) traffic: port 53”. Wireshark’s display filters (-Y) are a different language that only hides packets when reading; I didn’t need one here. The manual I quote is the current one; I checked each flag above in tshark -h and curl --help all on the versions I ran.

SSLKEYLOGFILE is how the encrypted part becomes readable later. curl, like Firefox and Chrome, writes “the encryption secrets” to that file so that Wireshark “can decrypt them” (everything curl). Anyone holding that file can read the whole session, so I deleted it afterwards and it’s not in this post. To read the capture with it:

tshark -r req.pcapng -o tls.keylog_file:keys.log

This was curl 7.76.1 with OpenSSL 3.5.9 and tshark 3.4.10, on 5 December 2026. In the output below I replaced my machine’s private address with my-machine.

All 32 packets
#

  #  time   direction           proto    bytes  info
  1  0.000  me → resolver (lo)  DNS         70  Standard query 0x6a35 A github.com
  2  0.000  me → resolver (lo)  DNS         70  Standard query 0xb733 AAAA github.com
  3  0.020  resolver → me (lo)  DNS        154  Standard query response 0xb733 AAAA github.com SOA ns-1707.awsdns-21.co.uk
  4  0.031  resolver → me (lo)  DNS         86  Standard query response 0x6a35 A github.com A 140.82.113.4
  5  0.031  me → GitHub         TCP         74  33678 → 443 [SYN] Seq=0 Win=64480 MSS=1240 SACK_PERM=1 WS=128
  6  0.064  GitHub → me         TCP         74  443 → 33678 [SYN, ACK] Seq=0 Ack=1 Win=65535 MSS=1436 SACK_PERM=1 WS=1024
  7  0.064  me → GitHub         TCP         66  33678 → 443 [ACK] Seq=1 Ack=1 Win=64512
  8  0.072  me → GitHub         TLSv1      583  Client Hello
  9  0.102  GitHub → me         TLSv1.3   2522  Server Hello, Change Cipher Spec, Encrypted Extensions
 10  0.102  GitHub → me         TLSv1.3    712  Certificate, Certificate Verify, Finished
 11  0.102  me → GitHub         TCP         66  33678 → 443 [ACK] Seq=518 Ack=2457 Win=69504
 12  0.102  me → GitHub         TCP         66  33678 → 443 [ACK] Seq=518 Ack=3103 Win=71936
 13  0.105  me → GitHub         TLSv1.3    130  Change Cipher Spec, Finished
 14  0.105  me → GitHub         HTTP2      161  SETTINGS[0]
 15  0.105  me → GitHub         HTTP2      164  HEADERS[1]: HEAD /
 16  0.128  GitHub → me         TCP         66  443 → 33678 [ACK] Seq=3103 Ack=582 Win=67584
 17  0.128  GitHub → me         TLSv1.3    224  New Session Ticket, New Session Ticket
 18  0.128  GitHub → me         HTTP2      130  SETTINGS[0], SETTINGS[0]
 19  0.128  me → GitHub         TCP         66  33678 → 443 [ACK] Seq=775 Ack=3325 Win=74368
 20  0.128  me → GitHub         HTTP2       97  SETTINGS[0]
 21  0.131  GitHub → me         TCP       4978  [TCP segment of a reassembled PDU]
 22  0.131  GitHub → me         HTTP2      845  HEADERS[1]: 200 OK
 23  0.131  me → GitHub         TCP         66  33678 → 443 [ACK] Seq=806 Ack=9016 Win=70912
 24  0.132  me → GitHub         TLSv1.3     90  Alert (Level: Warning, Description: Close Notify)
 25  0.132  me → GitHub         TCP         66  33678 → 443 [FIN, ACK] Seq=830 Ack=9016 Win=74368
 26  0.167  GitHub → me         TCP         78  [TCP Dup ACK 17#1] 443 → 33678 [ACK] Seq=9016 Ack=775 Win=67584
 27  0.167  GitHub → me         TCP         78  443 → 33678 [ACK] Seq=9016 Ack=806 Win=67584
 28  0.167  GitHub → me         TCP         66  443 → 33678 [ACK] Seq=9016 Ack=831 Win=67584
 29  0.167  GitHub → me         TLSv1.3     90  Alert (Level: Warning, Description: Close Notify)
 30  0.167  GitHub → me         TCP         66  443 → 33678 [FIN, ACK] Seq=9040 Ack=831 Win=67584
 31  0.167  me → GitHub         TCP         54  33678 → 443 [RST] Seq=831 Win=0
 32  0.167  me → GitHub         TCP         54  33678 → 443 [RST] Seq=831 Win=0

I removed the TCP timestamp fields from the info column; everything else is as tshark printed it. The rest of this post walks through them, step by step.

Step 1: find the server (DNS), packets 1 to 4
#

Before anything else, curl needs an address for github.com. It asks twice at once: an A record for an IPv4 address and an AAAA record, which “stores a single IPv6 address” (RFC 3596). GitHub has no IPv6 address, so the AAAA answer (packet 3) holds only an SOA record, the zone’s administrative entry. The A answer (packet 4) is 140.82.113.4, 31 ms later.

Layers: DNS is an application protocol. It travels over UDP to port 53, which the DNS standard has allowed since 1987 alongside TCP (RFC 1035, section 4.2).

The surprise: my first capture had no DNS packets at all. The resolver in WSL is 10.255.255.254, an address on the loopback interface. WSL’s DNS tunnelling “uses a virtualization feature to answer DNS requests from within WSL, instead of requesting them over a networking packet” (Microsoft Learn). So the lookup never touches the virtual network card. I had to capture on lo as well to see it.

Step 2: open a connection (TCP), packets 5 to 7
#

Now curl knows where to go, and TCP opens a connection with the three-way handshake, “the procedure used to establish a connection” (RFC 9293, section 3.5):

  1. SYN (packet 5): my machine picks a starting sequence number and asks to connect to port 443.
  2. SYN, ACK (packet 6): GitHub picks its own and acknowledges mine.
  3. ACK (packet 7): I acknowledge theirs. The connection is open.

tshark shows Seq=0 because it counts from zero; the real one, 1011181488 below, is random, “for security reasons”, as High Performance Browser Networking explains. Packets 5 to 6 also give the round-trip time: 33 ms from my machine to GitHub and back. Every later step costs at least one of those.

This is a good place to see all the layers at once. Here is packet 5, the SYN, as tshark decoded it, shortened, with my addresses replaced:

Ethernet II, Src: <my-machine's MAC>, Dst: <the virtual switch's MAC>
    Type: IPv4 (0x0800)
Internet Protocol Version 4, Src: my-machine, Dst: 140.82.113.4
    Time to Live: 64
    Protocol: TCP (6)
Transmission Control Protocol, Src Port: 33678, Dst Port: 443, Seq: 0, Len: 0
    Sequence Number (raw): 1011181488
    [...]
    Flags: 0x002 (SYN)
    Window: 64480
    TCP Option - Maximum segment size: 1240 bytes
    TCP Option - Window scale: 7 (multiply by 128)

Read it from the top, and each header says which layer comes next:

  • Link (Ethernet): from my network card to the next hop. Type: IPv4 says what’s inside. Both addresses have a Microsoft vendor prefix, because WSL runs in a Hyper-V virtual machine with a virtual network card.
  • Internet (IPv4): from my machine to GitHub’s address, across every network in between. Protocol: TCP (6) says what’s inside.
  • Transport (TCP): from port 33678 on my machine to port 443 on GitHub’s, plus the connection’s settings. The MSS (maximum segment size) of 1,240 bytes comes from this virtual network’s MTU of 1,280 bytes, minus 40 bytes of IPv4 and TCP headers.

There is no application data yet: Len: 0. A SYN is all headers.

Step 3: agree on keys and check identity (TLS), packets 8 to 13
#

With TCP open, TLS starts on top of it. This is the step my Handshake post shows in detail, so here only what’s different:

  • The ClientHello is 583 bytes, not the 1,491 I saw with openssl s_client. curl offered only classic key exchanges, with an X25519 key share. Same OpenSSL 3.5, different defaults: this system’s crypto policy lists X25519:secp256r1:X448:... and no ML-KEM, and curl follows it. So this connection is not post-quantum, and nothing on screen says so.
  • It offered ALPN h2,http/1.1: “the string h2 identifies the protocol where HTTP/2 uses Transport Layer Security”, and this is how the client asks for it during the TLS handshake (RFC 9113, section 3.1). GitHub chose h2.
  • Packets 9 and 10 have names only because I have the keys. Without the key log they are encrypted records. With it, tshark can open them and see Encrypted Extensions, Certificate, Certificate Verify and Finished.

The certificate chain, inside packet 10
#

This is the part my PKI post describes, travelling inside the encrypted handshake. Decrypted, packet 10 carries three certificates:

#SubjectIssued byValidSignature
1github.comSectigo Public Server Authentication CA DV E3630 Oct 2026 to 27 Jan 2027ECDSA with SHA-256
2Sectigo Public Server Authentication CA DV E36Sectigo Public Server Authentication Root E462021 to 2036ECDSA with SHA-384
3Sectigo Public Server Authentication Root E46USERTrust ECC Certification Authorityuntil 2038ECDSA with SHA-384

Each certificate is signed by the next one up. The top of the chain, the root my machine already trusts, is not sent: my machine has its own copy. curl walked this chain and reported ssl_verify_result 0, meaning it checked out. Then packet 10’s Certificate Verify proved that GitHub holds the private key for certificate 1, and Finished sealed the handshake. My side’s Finished is packet 13. From here on everything is symmetric: the suite was TLS_AES_128_GCM_SHA256, so AES-128-GCM with keys both sides derived, as the update to my SSL/TLS post explains.

This checking happens on my machine. The wire only carries the certificates; trusting them is my machine’s decision, which is exactly what the antivirus story was about.

Step 4: ask and answer (HTTP/2), packets 14 to 23
#

Now the actual request, inside TLS. HTTP/2 begins with a fixed connection preface (RFC 9113, section 3.4): it’s in packet 14, although tshark’s summary line shows only the SETTINGS frame after it. Then both sides exchange SETTINGS. Then packet 15 carries the request, decrypted:

:method: HEAD
:path: /
:scheme: https
:authority: github.com
user-agent: curl/7.76.1
accept: */*

The names starting with : are pseudo-headers, which HTTP/2 uses “to convey message control data” (RFC 9113, section 8.3). HEAD asks for the headers of the page without the page itself, which is what curl -I does.

The answer arrives in packets 21 and 22, 26 ms later. A selection of its headers:

:status: 200
content-type: text/html; charset=utf-8
strict-transport-security: max-age=31536000; includeSubdomains; preload
server: github.com
set-cookie: <three session cookies, values removed>
x-github-request-id: <removed>

strict-transport-security tells my browser to use HTTPS for GitHub for a year. I removed the cookie values and the request ID; they identify one visit, nothing more, but there’s no reason to publish them.

Packet 17 is two New Session Tickets: GitHub giving me a way to resume quickly next time without a full handshake.

Step 5: say goodbye, packets 24 to 32
#

Closing happens at two layers, top first:

  1. TLS close_notify (packet 24): my side “will not send any more messages on this connection” (RFC 9846, section 6.1).
  2. TCP FIN (packet 25): my side has finished sending.
  3. GitHub acknowledges, sends its own close_notify (29) and its FIN (30).
  4. Two RSTs (31, 32) from my machine. curl had already closed its socket, so when GitHub’s close_notify arrived there was no one left to read it. RFC 1122 says a TCP in that case “SHOULD send a RST to show that data was lost” (section 4.2.2.13). Here nothing important was lost: the lost data was a goodbye.

What 167 ms bought
#

PhasePacketsTimeLayer
DNS lookup1–40–31 msapplication, over UDP (here, over loopback)
TCP handshake5–731–64 mstransport
TLS handshake8–1372–105 msapplication (TLS, directly on TCP)
HTTP/2 request and answer14–23105–131 msapplication
Close24–32132–167 msapplication (TLS), then transport

Three round trips before a single byte of HTTP: one for DNS, one for TCP, one for TLS. That’s why connection reuse, session tickets and newer protocols that merge these steps exist, and High Performance Browser Networking is the best explanation of all of them I know.

Where to go deeper
#

Keywords
#

KeywordMeaning here
TCP/IP modelThe internet’s four layers: application, transport, internet, link
OSI modelThe seven-layer teaching model from ITU-T X.200 / ISO/IEC 7498-1
A / AAAA recordDNS answers holding an IPv4 / IPv6 address
Three-way handshakeSYN, SYN-ACK, ACK: how TCP opens a connection
Round-trip time (RTT)Time for a packet to reach the server and an answer to come back; 33 ms here
MSS / MTUThe largest TCP payload / the largest packet a link carries
ALPNThe TLS extension where client and server agree on HTTP/2 or HTTP/1.1
Key log (SSLKEYLOGFILE)A file of session secrets that lets Wireshark decrypt a capture
close_notify / FIN / RSTTLS’s goodbye, TCP’s goodbye, and TCP’s “this connection is gone”

Takeaways
#

  • One curl -I took 32 packets and 167 ms: DNS, TCP, TLS, HTTP/2 and a two-layer goodbye.
  • Each header names the layer inside it: Ethernet says IPv4, IPv4 says TCP, TCP says port 443.
  • Three round trips came before any HTTP. The certificate chain travels encrypted; trusting it happens on my machine.
  • My capture tool missed DNS until I knew WSL tunnels it, and curl quietly skipped post-quantum key exchange: both were invisible until I looked at the packets.

References
#

Author
Samarthya
Engineer, learner, tinkerer. This is my trophy shelf of everyday work and leisure.

Related

Reading the wire with tshark

In Every packet for my HTTPS request I typed a tshark command full of flags and moved on. This is the post I needed before that one: what each flag does, in the order you reach for them, with the real output. Every example is a script in samarthya/tshark-recipes, so you can run it yourself. One capture, many reads tshark is Wireshark without the window. The manual puts it as “Dump and analyze network traffic”: it captures packets, or reads a saved capture, and prints what it decodes. Because it is a terminal program it works where Wireshark can’t: over SSH, inside WSL, on a server with no screen.

The padlock's new rulebook

·5 mins
The padlock in your browser follows a rulebook. In July 2026 that rulebook got a new edition. Almost nobody noticed, and that was the point. Same version, new edition What’s an RFC? # The internet runs on agreements. When my machine talks to a website, both sides follow the same written rules, or the conversation falls apart. Those rules are published as numbered documents called RFCs. You don’t edit an old one in place: a new RFC with a new number is published, and the old page gets a banner saying “This RFC is now obsolete”. That’s exactly what happened to TLS 1.3 this year.

My antivirus answered for GitHub

··7 mins
I wrote a small program to check whether GitHub already uses post-quantum key exchange. It said yes. I was about to write that down as a fact when a different tool gave me a different answer, and the reason was sitting on my own machine. Two connections, one of them hidden A result that looked too good # While writing about the locks I use without noticing I wanted one line of evidence: which key exchange does a real site use today? Go makes that easy. Since Go 1.25 a connection reports the key-exchange group it used, and Python can do the same since 3.15, so this is the whole program in either: