http-2: Question: how to pass in data > 65,535 bytes

Hi Ilya, I’m trying to understand how to pass in data > 65,535 bytes.

When I issue the following response from a server:

conn.on(:stream) do |stream|

  # [...]

  body = "a" * 100_000
  headers = { ':content-length' => 100_000 } # snippet
  stream.headers(headers, end_stream: false)
  stream.data(body, end_stream: true)
end

Then on the receiving end (the client) I have:

stream.on(:data) do |data|
  p data.length
end

Which prints out:

16384
16384
16384
16383

which sums up to 65,535, the default window size, after which my client hangs waiting for more data (that never comes).

I have read about flow control but I’m not understanding if I’m supposed to change the window size on the fly (on the server?), or if I need to create a second stream with the remaining size of the data. If it’s the first option, the README file states to use:

stream.window_update(2048)

which is however an undefined method 'window_update' for #<HTTP2::Stream:0x007fd9cd18f548>, or a:

conn.settings(streams: 100, window: Float::INFINITY)

which raises an HTTP2::Error::CompressionError: Unknown settings ID for error.

Can you please advise? Thank you.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 15 (6 by maintainers)

Commits related to this issue

Most upvoted comments

@bw1109 this repo is for the Ruby http/2 library, your code is referencing a Python lib… 😃