snapview/tungstenite-rs

Is it possible not to enforce frame max size limit

HollowMan6 opened this issue · 1 comments

Hi! I'm relying on rust-headless-chrome to generate some pdf files from web pages. I'm noticing that, if I try to generate some pdf files that is relatively large, like 25MB, the pdf generation will fail with error Capacity(MessageTooLong { size: 47175864, max_size: 16777216 }), which eventually leads me here, as rust-headless-chrome has the tungstenite v0.18.0 dependency. rust-headless-chrome/rust-headless-chrome#385

Then I tried to disable the frame max size limit and see if there would be any error or panic for the same pdf generation process. https://github.com/HollowMan6/mdbook-pdf-tungstenite/commit/632185567b4b9118ada457509e966585b8d19b2e Then to my suprise, the pdf generation actually works well, so now I'm wondering why you have this limit check. If it's about the security or specification reasons, would you add some kind of option to allow us to bypass this check so that the rust-headless-chrome can support large pdf files generation? Thank you!

Hey! We do actually allow users to specify the maximum size of the frame. I.e. you don't really need to modify tungstenite to allow the behavior, you simply can pass the reasonable value (or max value) to the client config when creating a WebSocket connection.

So perhaps instead of using connect() helper (that's what rust-headless-chrome uses), you could use client_tls_with_config().