IO::As...Stream(3pm)

πŸ“¦
version 0.25 Β· 6 versions
, in debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

✨ IO::As...Stream(3pm) ✨

okay bestie, this one lives in the User Contributed Perl Documentation section, and it's a lil baby page but it's a useful lil baby page, so let's go πŸ’–


🌸 NAME 🌸

IO::Async::SSLStream β€” read and write buffers around an SSL connection πŸ¦‹


πŸŽ€ DESCRIPTION πŸŽ€

okay so. This is a subclass of IO::Async::Stream, and what it does is give you support for using an SSL connection β€” specifically the kind that gets created by IO::Async::SSL's SSL_connect or SSL_listen extension methods ✨

Here's the flow, bestie: once one of those methods hands you a socket handle, you wrap that handle up in an IO::Async::SSLStream object. That's the whole move. And why? So you get the usual on_read callback working like you'd expect πŸ’…

And here's the lowkey iconic part: it provides no extra methods and consumes no extra configuration parameters. None. Zero. Nada. So just treat it exactly like a regular IO::Async::Stream object, because that's literally what it is, just with SSL energy 🌈

fr fr, go check the main IO::Async::SSL documentation β€” there's an example of its use in there and it'll make everything click πŸ‘‘

πŸ’€ BUGS πŸ’€

okay so here's the part where we keep it real:

  • Currently, this subclass does not completely handle the autoflush configure option. 😭 Here's why that's a problem: it's possible for the SSL_write(3ssl) call to fail with EAGAIN and SSL_WANT_READ, which is the call basically saying "hey, I actually wanna read right now" β€” maybe it needs fresh keys from the server or whatever. And in that case, the subclass will not correctly poll for readability and retry the write operation. πŸ™ˆ So the write just... doesn't get retried properly. This bug does not occur with regular write when autoflush is turned off, so it's specific to this situation, no cap.

🫢 AUTHOR 🫢

Paul Evans <leonerd@leonerd.org.uk> β€” king behavior, honestly πŸ‘‘


and that's the whole page, bestie!! this doc is from perl v5.36.0, dated 2023-09-29, and it was brought to you by the User Contributed Perl Documentation girlies πŸŽ€ go forth and wrap those sockets, you got this πŸ’œ

πŸ“¦ where this page comes from