Fix for a newly intrduced bug in #5377
Motivation This bug was introduced with #5377 and affects only users who'd like to share/cache/re-use `PemPrivateKey` and `PemX509Certificate` instances. Modifications Use `ByteBuf#writeBytes(src, readerIndex, length)` so that the src's readerIndex doesn't change and can consequently be used more than once. Result It's possible to share/cache/re-use `PemPrivateKey` and `PemX509Certificate` instances as long as their refCnt remains >= 1.
This commit is contained in:
parent
9bfeab2c8a
commit
fe569ea7a3
@ -547,7 +547,7 @@ public abstract class OpenSslContext extends SslContext {
|
||||
|
||||
ByteBuf buffer = allocator.directBuffer(content.readableBytes());
|
||||
try {
|
||||
buffer.writeBytes(content);
|
||||
buffer.writeBytes(content, content.readerIndex(), content.readableBytes());
|
||||
return newBIO(buffer.retainedSlice());
|
||||
} finally {
|
||||
try {
|
||||
|
Loading…
Reference in New Issue
Block a user