Skip to content

Instantly share code, notes, and snippets.

@kenichi
Created October 27, 2016 17:18
Show Gist options
  • Save kenichi/1c33a4a70563d66417d42639b6a8fa8a to your computer and use it in GitHub Desktop.
Save kenichi/1c33a4a70563d66417d42639b6a8fa8a to your computer and use it in GitHub Desktop.
$ ruby example/upgrade_server.rb
Starting server on port 8080
New TCP connection!
Sent frame: {:type=>:settings, :stream=>0, :payload=>[[:settings_max_concurrent_streams, 100]]}
Received frame: {:length=>12, :type=>:settings, :flags=>[], :stream=>0, :payload=>[[:settings_max_concurrent_streams, 100], [:settings_initial_window_size, 65535]]}
[Stream 1]: client opened new stream
[Stream 1]: request headers: {":scheme"=>"http", ":method"=>"GET", ":authority"=>nil, ":path"=>"/", "host"=>"localhost:8080", "connection"=>"Upgrade, HTTP2-Settings", "upgrade"=>"h2c", "http2-settings"=>
"AAMAAABkAAQAAP__", "accept"=>"*/*", "user-agent"=>"nghttp2/1.16.0-DEV"}
[Stream 1]: client closed its end of the stream
[Stream 1]: Received GET request
Sent frame: {:type=>:headers, :flags=>[:end_headers], :payload=>[[":status", "200"], ["content-length", "27"], ["content-type", "text/plain"]], :stream=>1}
Sent frame: {:type=>:data, :flags=>[], :payload=>"Hello", :stream=>1}
Sent frame: {:type=>:data, :flags=>[:end_stream], :payload=>" HTTP 2.0! GET request", :stream=>1}
[Stream 1]: stream closed
Sent frame: {:type=>:settings, :stream=>0, :payload=>[[:settings_max_concurrent_streams, 100]]}
Received frame: {:length=>12, :type=>:settings, :flags=>[], :stream=>0, :payload=>[[:settings_max_concurrent_streams, 100], [:settings_initial_window_size, 65535]]}
Sent frame: {:type=>:settings, :stream=>0, :payload=>[], :flags=>[:ack]}
Sent frame: {:type=>:goaway, :last_stream=>1, :error=>:protocol_error, :payload=>nil}
Exception: Broken pipe, Broken pipe - closing socket.
/Users/ken/src/ruby/http-2/lib/http/2/connection.rb:357:in `block in send'
/Users/ken/src/ruby/http-2/lib/http/2/connection.rb:357:in `each'
/Users/ken/src/ruby/http-2/lib/http/2/connection.rb:357:in `send'
/Users/ken/src/ruby/http-2/lib/http/2/connection.rb:140:in `goaway'
/Users/ken/src/ruby/http-2/lib/http/2/connection.rb:653:in `connection_error'
/Users/ken/src/ruby/http-2/lib/http/2/connection.rb:331:in `rescue in receive'
/Users/ken/src/ruby/http-2/lib/http/2/connection.rb:170:in `receive'
example/upgrade_server.rb:181:in `block in <main>'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment