gitee.com/ks-custle/core-gm@v0.0.0-20230922171213-b83bdd97b62c/net/http2/h2i/README.md (about)

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