You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

97 lines
2.4 KiB

  1. # h2i
  2. **h2i** is an interactive HTTP/2 ("h2") console debugger. Miss the good ol'
  3. days of telnetting to your HTTP/1.n servers? We're bringing you
  4. back.
  5. Features:
  6. - send raw HTTP/2 frames
  7. - PING
  8. - SETTINGS
  9. - HEADERS
  10. - etc
  11. - type in HTTP/1.n and have it auto-HPACK/frame-ify it for HTTP/2
  12. - pretty print all received HTTP/2 frames from the peer (including HPACK decoding)
  13. - tab completion of commands, options
  14. Not yet features, but soon:
  15. - unnecessary CONTINUATION frames on short boundaries, to test peer implementations
  16. - request bodies (DATA frames)
  17. - send invalid frames for testing server implementations (supported by underlying Framer)
  18. Later:
  19. - act like a server
  20. ## Installation
  21. ```
  22. $ go get golang.org/x/net/http2/h2i
  23. $ h2i <host>
  24. ```
  25. ## Demo
  26. ```
  27. $ h2i
  28. Usage: h2i <hostname>
  29. -insecure
  30. Whether to skip TLS cert validation
  31. -nextproto string
  32. Comma-separated list of NPN/ALPN protocol names to negotiate. (default "h2,h2-14")
  33. $ h2i google.com
  34. Connecting to google.com:443 ...
  35. Connected to 74.125.224.41:443
  36. Negotiated protocol "h2-14"
  37. [FrameHeader SETTINGS len=18]
  38. [MAX_CONCURRENT_STREAMS = 100]
  39. [INITIAL_WINDOW_SIZE = 1048576]
  40. [MAX_FRAME_SIZE = 16384]
  41. [FrameHeader WINDOW_UPDATE len=4]
  42. Window-Increment = 983041
  43. h2i> PING h2iSayHI
  44. [FrameHeader PING flags=ACK len=8]
  45. Data = "h2iSayHI"
  46. h2i> headers
  47. (as HTTP/1.1)> GET / HTTP/1.1
  48. (as HTTP/1.1)> Host: ip.appspot.com
  49. (as HTTP/1.1)> User-Agent: h2i/brad-n-blake
  50. (as HTTP/1.1)>
  51. Opening Stream-ID 1:
  52. :authority = ip.appspot.com
  53. :method = GET
  54. :path = /
  55. :scheme = https
  56. user-agent = h2i/brad-n-blake
  57. [FrameHeader HEADERS flags=END_HEADERS stream=1 len=77]
  58. :status = "200"
  59. alternate-protocol = "443:quic,p=1"
  60. content-length = "15"
  61. content-type = "text/html"
  62. date = "Fri, 01 May 2015 23:06:56 GMT"
  63. server = "Google Frontend"
  64. [FrameHeader DATA flags=END_STREAM stream=1 len=15]
  65. "173.164.155.78\n"
  66. [FrameHeader PING len=8]
  67. Data = "\x00\x00\x00\x00\x00\x00\x00\x00"
  68. h2i> ping
  69. [FrameHeader PING flags=ACK len=8]
  70. Data = "h2i_ping"
  71. h2i> ping
  72. [FrameHeader PING flags=ACK len=8]
  73. Data = "h2i_ping"
  74. h2i> ping
  75. [FrameHeader GOAWAY len=22]
  76. Last-Stream-ID = 1; Error-Code = PROTOCOL_ERROR (1)
  77. ReadFrame: EOF
  78. ```
  79. ## Status
  80. Quick few hour hack. So much yet to do. Feel free to file issues for
  81. bugs or wishlist items, but [@bmizerany](https://github.com/bmizerany/)
  82. and I aren't yet accepting pull requests until things settle down.