Commit Graph

5 Commits

Author SHA1 Message Date
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