Comments (11)
I argee. And when ssl:read() returns want_read, the loop should end.
from lua-openssl.
according to https://github.com/zhaozg/lua-openssl/blob/master/src/ssl.c#L1417-L1418,
ssl:read([number bytes=ssl:pending()]), will always try to read all pending data if not given bytes to read,
so I think your options are done already.
from lua-openssl.
I called ssl:read() in my program (without any argument), it didn't read all pending data in the memory bio. Then if I call ssl:read() again, more data will be readed, without any new data pushed to the memory bio.
from lua-openssl.
OK, I'll check it, maybe bugs.
from lua-openssl.
@imzyxwvu 可能是在读完之后新产生的数据吧,即使实在ssl:read()中加上读取的参数也会出现这种现象
from lua-openssl.
@zhaozg 不,我自己写的uv绑定,参考那个lib重新实现。我向input mem bio里面写了数据之后有的时候只从ssl对象上read一次只读出了一部分数据,不够,但是接收数据回调没被再次调用。但是如果我在没有往mem bio写入新数据的情况下再调用一次read就能读出剩下的数据。我再翻翻openssl文档。我晚上试试写个程序重现下。
translation: I wrote a libuv binding myself (not luv), so I referenced that lua lib to implement one for my own binding. When I wrote some data to the input mem bio, ssl:read() succeeded but didn't return all data expected, but the on-data callback wasn't trigged any more. So I tried to call ssl:read() again and it returned the left data. I will try to write a program to show you the problem tonight.
from lua-openssl.
我最近太忙了,可能没有办法及时解决这个问题,我尽快处理这个问题吧。
I'm busy now, can't solve this problem in a timely, please wait some days to deal with this issue. thanks.
from lua-openssl.
@zhaozg 我看了下 openssl document,你的C代码没错。ssl底层数据流是由许多records组成的,SSL_pending返回当前正在处理的那一个record中还未读取的字节数,如果一次性写入input bio多个ssl record,那么openssl会依次处理,SSL_pending每次只返回当前正处理的record中剩余的字节数,只有你用SSL_read把当前record读完了,openssl才处理下一个record(如果bio中下一个record还不完整,SSL_pending返回0),这也就是要循环read的原因。
translation: in a word, there is nothing wrong in the C code.
from lua-openssl.
remember openssl document said that SSL_read may also yields WANT_WRITE.
from lua-openssl.
@imzyxwvu thanks
from lua-openssl.
https://github.com/zhaozg/lua-openssl/blob/master/ldoc/ssl.lua#L218
from lua-openssl.
Related Issues (20)
- ecdsa prime256v1
- TODO/FIXME list
- undefined symbol: d2i_OCSP_REQUEST, by openssl version 1.1.1 and lua5.4 HOT 1
- Luarocks.org module does not support 5.4 HOT 1
- ECC verify is not working as expected HOT 3
- 实在搞不定了了 make安装正常 HOT 3
- Compilation will fail with >=clang-16: src/ocsp.c: error: incompatible function pointer types passing char ( )() to parameter of type d2i HOT 6
- Support ED25519 and co.
- Compile with C++ HOT 1
- Build without external dependencies HOT 1
- src/mac.c not included in library target
- 编译报错
- openssl.error() return values changed order
- gcm support HOT 1
- Add logs and update the docs to inform that FIPS is intentionally disabled for OpenSSL1.1.1 and OpenSSL 1.0.2 series HOT 3
- Can't install via luarocks with --verify flag HOT 1
- Having trouble creating an EC PRIVATE KEY with explicit curve (which seems to make a longer key) HOT 1
- Link against the Lua library on Unix/Linux
- Cant compile
- ocsp.c:190:29: error: passing argument 1 of PEM_ASN1_read_bio from incompatible pointer type HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lua-openssl.