Skip to content

Commit fb07f77

Browse files
committed
Slightly improved ASCII art diagram.
1 parent bf18c8b commit fb07f77

File tree

1 file changed

+39
-37
lines changed

1 file changed

+39
-37
lines changed

lib/protocol/http2/stream.rb

Lines changed: 39 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
module Protocol
1010
module HTTP2
11-
# A single HTTP 2.0 connection can multiplex multiple streams in parallel:
11+
# A single HTTP/2 connection can multiplex multiple streams in parallel:
1212
# multiple requests and responses can be in flight simultaneously and stream
1313
# data can be interleaved and prioritized.
1414
#
@@ -18,42 +18,44 @@ module HTTP2
1818
# diagram below) and provide your application logic to handle request
1919
# and response processing.
2020
#
21-
# +--------+
22-
# send PP | | recv PP
23-
# ,--------| idle |--------.
24-
# / | | \
25-
# v +--------+ v
26-
# +----------+ | +----------+
27-
# | | | send H / | |
28-
# ,------| reserved | | recv H | reserved |------.
29-
# | | (local) | | | (remote) | |
30-
# | +----------+ v +----------+ |
31-
# | | +--------+ | |
32-
# | | recv ES | | send ES | |
33-
# | send H | ,-------| open |-------. | recv H |
34-
# | | / | | \ | |
35-
# | v v +--------+ v v |
36-
# | +----------+ | +----------+ |
37-
# | | half | | | half | |
38-
# | | closed | | send R / | closed | |
39-
# | | (remote) | | recv R | (local) | |
40-
# | +----------+ | +----------+ |
41-
# | | | | |
42-
# | | send ES / | recv ES / | |
43-
# | | send R / v send R / | |
44-
# | | recv R +--------+ recv R | |
45-
# | send R / `----------->| |<-----------' send R / |
46-
# | recv R | closed | recv R |
47-
# `----------------------->| |<----------------------'
48-
# +--------+
49-
#
50-
# send: endpoint sends this frame
51-
# recv: endpoint receives this frame
52-
#
53-
# H: HEADERS frame (with implied CONTINUATIONs)
54-
# PP: PUSH_PROMISE frame (with implied CONTINUATIONs)
55-
# ES: END_STREAM flag
56-
# R: RST_STREAM frame
21+
# ```
22+
# ┌────────┐
23+
# send PP │ │ recv PP
24+
# ┌──────────┤ idle ├──────────┐
25+
# │ │ │ │
26+
# ▼ └───┬────┘ ▼
27+
# ┌──────────┐ │ ┌──────────┐
28+
# │ │ │ send H / │ │
29+
# ┌──────┼ reserved │ │ recv H │ reserved ├──────┐
30+
# │ │ (local) │ │ │ (remote) │ │
31+
# │ └───┬──────┘ ▼ └──────┬───┘ │
32+
# │ │ ┌────────┐ │ │
33+
# │ │ recv ES │ │ send ES │ │
34+
# │ send H │ ┌─────────┤ open ├─────────┐ │ recv H │
35+
# │ │ │ │ │ │ │ │
36+
# │ ▼ ▼ └───┬────┘ ▼ ▼ │
37+
# │ ┌──────────┐ │ ┌──────────┐ │
38+
# │ │ half │ │ │ half │ │
39+
# │ │ closed │ │ send R / │ closed │ │
40+
# │ │ (remote) │ │ recv R │ (local) │ │
41+
# │ └────┬─────┘ │ └─────┬────┘ │
42+
# │ │ │ │ │
43+
# │ │ send ES / │ recv ES / │ │
44+
# │ │ send R / ▼ send R / │ │
45+
# │ │ recv R ┌────────┐ recv R │ │
46+
# │ send R / └───────────►│ │◄───────────┘ send R / │
47+
# │ recv R │ closed │ recv R │
48+
# └───────────────────────►│ │◄───────────────────────┘
49+
# └────────┘
50+
# ```
51+
#
52+
# - `send`: endpoint sends this frame
53+
# - `recv`: endpoint receives this frame
54+
#
55+
# - H: HEADERS frame (with implied CONTINUATIONs)
56+
# - PP: PUSH_PROMISE frame (with implied CONTINUATIONs)
57+
# - ES: END_STREAM flag
58+
# - R: RST_STREAM frame
5759
#
5860
# State transition methods use a trailing "!".
5961
class Stream

0 commit comments

Comments
 (0)