Commit Graph

7 Commits

Author SHA1 Message Date
Willy Tarreau f3a19e70e8 DEV: h2: support hex-encoded data sequences in mkhdr
For HPACK-encoded headers (particularly with huffman encoding), it's
really necessary to support hex sequences as they appear in RFC7541
examples, so let's support hex digit pairs with -R.

Now it's possible to do this to send GET https://www.example.com/ :

    (dev/h2/mkhdr.sh -t p; dev/h2/mkhdr.sh -t s;
     dev/h2/mkhdr.sh -t h -i 1 -f es,eh \
     -R '8286 8441 0f77 7777 2e65 7861 6d70 6c65 2e63 6f6d ') | nc 0 8080
2024-01-12 18:59:59 +01:00
Willy Tarreau 5bf19f8b57 DEV: h2: add support for multiple flags in mkhdr
The mkhdr script did not support passing multiple flags at once using
symbolic names. That's now done.
2024-01-12 18:59:59 +01:00
Willy Tarreau 57f8a4e879 DEV: h2: support passing raw data for a frame
With -r it's possible to pass raw data that will be interpreted by
printf so it even supports \x sequences. E.g. for a RST_STREAM, let's
just use \x00\x00\x00\x00.
2024-01-06 11:02:37 +01:00
Willy Tarreau ec8ea73bc0 DEV: h2: add the preface as well in supported output types
It's annoying to always have to append it from a capture, let's also
support producing the preface.
2024-01-06 11:02:37 +01:00
Willy Tarreau 57b6c17099 DEV: h2: add the ability to emit literals in mkhdr
It's sometimes needed to be able to build a headers frame, let's
add this by permitting to encode key/value pairs as literal headers.
2024-01-06 11:02:37 +01:00
Willy Tarreau e8ae99b111 DEV: h2: support reading frame payload from a file
Now we can build a series of data frames by reading from a file and
chunking it into frames of requested length. It's mostly useful for
data frames (e.g. post). One way to announce these upfront is to
capture the output of curl use without content-length:

  $ nc -lp4446 > post-h2-nocl.bin
  $ curl -v --http2-prior-knowledge http://127.0.0.1:4446/url -H "content-length:" -d @/dev/null

Then just change the 5th byte from the end from 1 to 0 to remove the
end-of-stream bit, it will allow to chain a file, then to send an
empty DATA frame with ES set :

  $ (dev/h2/mkhdr.sh -i 1 -t data -d CHANGELOG;
     dev/h2/mkhdr.sh -i 1 -t data -l 0 -f es) > h2-data-changelog.bin

Then post that to the server:
  $ cat post-h2-nocl.bin h2-data-changelog.bin | nc 0 4446
2023-04-26 11:36:02 +02:00
Willy Tarreau 78bb934607 DEV: h2: add a script "mkhdr" to build h2 frames from scratch
It's a real pain to try to trigger certain edge cases in h2, so let's
write a simple tool aiming at creating frames.
2023-04-26 11:35:45 +02:00