You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Calling WithCompression with an empty name or nil constructors is a no-op.
However, tracing through the code, this is not true. The constructors are never checked for nil. Instead, any existing compressor previously registered with the same name is blindly overwritten with an invalid one. It is invalid because if either constructor is nil and ends up needing to be used, it will cause a nil dereference panic in the compressionPoolhere and here.
Perhaps this should instead behave like WithAcceptCompression? In that option, the constructors are checked. But if they are both nil, it effectively unregisters the named compression algorithm (instead of being a no-op).
The text was updated successfully, but these errors were encountered:
The doc comment for
WithCompression
states:However, tracing through the code, this is not true. The constructors are never checked for nil. Instead, any existing compressor previously registered with the same name is blindly overwritten with an invalid one. It is invalid because if either constructor is nil and ends up needing to be used, it will cause a nil dereference panic in the
compressionPool
here and here.Perhaps this should instead behave like
WithAcceptCompression
? In that option, the constructors are checked. But if they are both nil, it effectively unregisters the named compression algorithm (instead of being a no-op).The text was updated successfully, but these errors were encountered: