Skip to content

Instantly share code, notes, and snippets.

@igrigorik
Created September 16, 2013 00:01
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save igrigorik/055e72a3dd0a2f86d153 to your computer and use it in GitHub Desktop.
Save igrigorik/055e72a3dd0a2f86d153 to your computer and use it in GitHub Desktop.
HTTP 2.0 library starting to come together.. 154 green specs!
igrigorik { /git/http-2 } > rake spec
/Users/igrigorik/.rvm/rubies/ruby-2.0.0-p247/bin/ruby -S rspec ./spec/compressor_spec.rb ./spec/connection_spec.rb ./spec/emitter_spec.rb ./spec/framer_spec.rb ./spec/stream_spec.rb
HTTP2::Header
literal representation
integer
should encode 10 using a 5-bit prefix
should encode 10 using a 0-bit prefix
should encode 1337 using a 5-bit prefix
should encode 1337 using a 0-bit prefix
string
should handle ascii codepoints
should handle utf-8 codepoints
should handle long utf-8 strings
header representation
should handle indexed representation
literal w/o indexing representation
should handle indexed header
should handle literal header
literal w/ incremental indexing
should handle indexed header
should handle literal header
literal w/ substitution indexing
should handle indexed header
should handle literal header
differential coding
shared compression context
should be initialized with pre-defined headers
should be initialized with empty working set
should update working set based on prior state
processing
should toggle index representation headers in working set
no indexing
should process indexed header with literal value
should process indexed header with default value
should process literal header with literal value
incremental indexing
should process literal header with literal value
substitution indexing
should process literal header with literal value
should raise error on invalid substitution index
size bounds
should drop headers from beginning of table
should prepend on dropped substitution index
integration
should match first header set in spec appendix
should match second header set in spec appendix
encode and decode
should match first header set in spec appendix
should decode first header set in spec appendix
should match second header set in spec appendix
should decode second header set in spec appendix
encode-decode should be invariant
HTTP2::Connection
initialization and settings
should return odd ids for client requests
should raise error if first frame is not SETTINGS
should raise error if SETTINGS stream != 0
stream management
should initialize to default stream limit (infinite)
should change stream limit to received SETTINGS value
should count open streams against stream limit
should not count reserved streams against stream limit
should not exceed stream limit set by peer
should initialize stream with HEADERS priority value
push
should raise error on PUSH_PROMISE against stream 0
should raise error on PUSH_PROMISE against bogus stream
should raise error on PUSH_PROMISE against non-idle stream
should emit stream object for received PUSH_PROMISE
should auto RST_STREAM promises against locally-RST stream
flow control
should initialize to default flow window
should update connection and stream windows on SETTINGS
should initialize streams with window specified by peer
should support global disable of flow control
should raise error on flow control after disabling it
should observe connection flow control
framing
should buffer incomplete frames
should decompress header blocks regardless of stream state
should decode non-contiguous header blocks
should require that split header blocks are a contiguous sequence
should emit encoded frames via on(:frame)
should compress stream headers
connection management
should respond to PING frames
should fire callback on PONG
should fire callback on receipt of GOAWAY
should raise error when opening new stream after sending GOAWAY
should raise error when opening new stream after receiving GOAWAY
should process connection management frames after GOAWAY
API
.settings should emit SETTINGS frames
.ping should generate PING frames
.goaway should generate GOAWAY frame with last processed stream ID
HTTP2::Emitter
should raise error on missing callback
should allow multiple callbacks on single event
should execute callback with optional args
should allow events with no callbacks
should execute callback exactly once
HTTP2::Framer
should determine frame length
should parse single frame at a time
should process full frames only
common header
should generate common 8 byte header
should parse common 8 byte header
should raise exception on invalid frame type
should raise exception on invalid stream ID
should raise exception on invalid frame flag
should raise exception on invalid frame size
DATA
should generate and parse bytes
HEADERS
should generate and parse bytes
should carry an optional stream priority
PRIORITY
should generate and parse bytes
RST_STREAM
should generate and parse bytes
SETTINGS
should generate and parse bytes
should encode custom settings
should raise exception on invalid stream ID
should raise exception on invalid setting
PUSH_PROMISE
should generate and parse bytes
PING
should generate and parse bytes
should raise exception on invalid payload
GOAWAY
should generate and parse bytes
should treat debug payload as optional
WINDOW_UPDATE
should generate and parse bytes
CONTINUATION
should generate and parse bytes
HTTP2::Stream
stream states
should initiliaze all streams to IDLE
reserved (local)
should transition on sent PUSH_PROMISE
should allow HEADERS to be sent
should raise error if sending invalid frames
should raise error on receipt of invalid frames
should transition to half closed (remote) on sent HEADERS
should transition to closed on sent RST_STREAM
should transition to closed on received RST_STREAM
should reprioritize stream on PRIORITY
reserved (remote)
should transition on received PUSH_PROMISE
should raise error if sending invalid frames
should raise error on receipt of invalid frames
should transition to half closed (local) on received HEADERS
should transition to closed on sent RST_STREAM
should transition to closed on received RST_STREAM
should reprioritize stream on PRIORITY
open
should allow any valid frames types to be sent
should allow frames of any type to be received
should transition to half closed (local) if sending END_STREAM
should transition to half closed (remote) if receiving END_STREAM
should transition to half closed if remote opened with END_STREAM
should transition to half closed if local opened with END_STREAM
should transition to closed if sending RST_STREAM
should transition to closed if receiving RST_STREAM
should emit :active on open transition
should emit :close on close transition
should emit reason with :close event
half closed (local)
should raise error on attempt to send frames
should transition to closed on receipt of END_STREAM flag
should transition to closed on receipt of RST_STREAM frame
should transition to closed if RST_STREAM frame is sent
should ignore received WINDOW_UPDATE, PRIORITY frames
should emit :close event on close transition
half closed (remote)
should raise STREAM_CLOSED error on reciept of frames
should transition to closed if END_STREAM flag is sent
should transition to closed if RST_STREAM is sent
should transition to closed on reciept of RST_STREAM frame
should ignore received WINDOW_UPDATE frames
should emit :close event on close transition
closed
remote closed stream
should raise STREAM_CLOSED on attempt to send frames
should raise STREAM_CLOSED on receipt of frame
should allow RST_STREAM to be sent
should not send RST_STREAM on receipt of RST_STREAM
local closed via RST_STREAM frame
should ignore received frames
local closed via END_STREAM flag
should ignore received frames
flow control
should initialize to default flow control window
should update window size on DATA frames only
should update window size on receipt of WINDOW_UPDATE
should observe session flow control
client API
.priority should emit PRIORITY frame
.headers should emit HEADERS frames
.data should emit DATA frames
.data should split large DATA frames
server API
should emit received headers via on(:headers)
should emit received payload via on(:data)
should emit received priority via on(:priority)
Finished in 0.07806 seconds
154 examples, 0 failures
@xiaods
Copy link

xiaods commented Sep 16, 2013

cool!

Copy link

ghost commented Sep 16, 2013

is this on github yet?

@igrigorik
Copy link
Author

@robgleeson now it is: https://github.com/igrigorik/http-2 (apologies about the wait :))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment