ostinelli / apnotic

A Ruby APNs HTTP/2 gem able to provide instant feedback.
MIT License
480 stars 96 forks source link

Rails app crashing when using integer value for header #42

Closed printercu closed 7 years ago

printercu commented 7 years ago

Hi!

I had notifiaction.apns_collapse_id = order.id and app was crashing with HTTP2::Error::ProtocolError (HTTP2::Error::ProtocolError) and no backtrace. Sometimes exception was rescued with message undefined method 'bytesize' for 2:Fixnum. But sometimes it wasn't even rescued, app just crashed.

Changing to order.id.to_s fixed this.

ostinelli commented 7 years ago

Thank you for your report. This needs a patch here, will do ASAP.

printercu commented 7 years ago

Is it possible to fix http-2 lib, so it would not crash ruby process if any other possible header is not string?

ostinelli commented 7 years ago

Yes, that is a possibility, thanks for the suggestion. I am unsure whether the underlying http-2 gem requires al headers to be string though. Will need to check that out.

ostinelli commented 7 years ago

This is now fixed in https://github.com/ostinelli/net-http2/commit/e2c15d3f2fe79b0b56655b199c120e7491881aca.