Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

method conn:shutdown() is missing #181

Closed
Tieske opened this issue Nov 3, 2021 · 4 comments
Closed

method conn:shutdown() is missing #181

Tieske opened this issue Nov 3, 2021 · 4 comments

Comments

@Tieske
Copy link
Member

Tieske commented Nov 3, 2021

while writing compatibility stuff I ran into this method missing in LuaSec. Whilst LuaSocket does have it.

would it be possible to add the method? Or provide any hints as where/how to add it?

@brunoos
Copy link
Member

brunoos commented Nov 4, 2021

I do not remember why it is not implemented, but I think because the LuaSocket´s shutdown() has a mode as parameter that cannot be mapped directly to OpenSSL.

https://aiq0.github.io/luasocket/tcp.html#shutdown
https://www.openssl.org/docs/man1.1.1/man3/SSL_shutdown.html

@Tieske
Copy link
Member Author

Tieske commented Nov 4, 2021

ah, that explains it. But then wouldn't it make sense (to be compatible) to implement it but ignore the parameter if it is provided, meaning that LuaSec would always use the "both" option as specified by LuaSocket. And then document the discrepancy in behavior between the two?

@Tieske
Copy link
Member Author

Tieske commented Nov 4, 2021

Reading the links, I assume that a plain TCP socket can shutdown either receive or send. But with TLS, even for just reading, there might be reads and writes required on the TCP level, hence my guess is that with TLS you can either shutdown both, or none. No expert on this topic however...

@brunoos
Copy link
Member

brunoos commented Nov 8, 2021

It seems thatSSL_shutdown() just closes the TLS part, the socket is still usable. So, implement conn:shutdown()as "closing everything" is possible, but it changes the semantic from SSL_shutdown() and this can cause some confusion. I think that use conn:close() for now is better.

@brunoos brunoos closed this as completed Nov 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants