Add option to locally enforce payload size limit#515
Merged
sodabrew merged 3 commits intophp-memcached-dev:masterfrom Apr 27, 2023
Merged
Add option to locally enforce payload size limit#515sodabrew merged 3 commits intophp-memcached-dev:masterfrom
sodabrew merged 3 commits intophp-memcached-dev:masterfrom
Conversation
…no limit. Wiring size limit check into payload construction, generating ITEM TOO BIG error in excess of limit.
Collaborator
|
Looks nice! I think the smaller functions could be rolled together since they're only used once. Update: approved the CI run and all tests pass. Nice work! |
m6w6
added a commit
that referenced
this pull request
Sep 26, 2024
- Add #515 option to locally enforce payload size limit - Add #539 zstd support - Add #540 compression_level option - Mark password as a sensitive param for PHP 8.2 - Fix Windows PHP 8 compatibility - Fix #518 Windows msgpack support - Fix #522 signed integer overflow - Fix #523 incorrect PHP reflection type for Memcached::cas $cas_token - Fix #546 don't check key automatically, unless client-side verify_key is enabled - Fix #555 incompatible pointer types (32-bit)
m6w6
added a commit
that referenced
this pull request
Oct 4, 2024
- Add #515 option to locally enforce payload size limit - Add #539 zstd support - Add #540 compression_level option - Mark password as a sensitive param for PHP 8.2 - Fix Windows PHP 8 compatibility - Fix #518 Windows msgpack support - Fix #522 signed integer overflow - Fix #523 incorrect PHP reflection type for Memcached::cas $cas_token - Fix #546 don't check key automatically, unless client-side verify_key is enabled
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This creates a new Memcached option item_size_limit to locally enforce a maximum payload size. The intent behind use of this option is to mirror the Memcached server maximum item size configuration in PHP Memcached client configuration, permitting client optimization by avoiding issuance over the network of large payloads which are destined to be rejected by the server.
Payload size is determined after compression, when applicable, and it is in consideration of payload compression that the option is being introduced at the extension level. PHP callers cannot themselves perfectly enforce a payload size limit without the undue burden of mirroring compression of the payload. Alternatively, placement within libmemcached, while perhaps also desirable, does not permit PHP application-level configuration.
The Memcached INI has been extended to support the option via "memcached.item_size_limit" as has Memcached::setOption(), which uses the newly-added Memcached::OPT_ITEM_SIZE_LIMIT. No limit is enforced by default, and a value of "0" implies no limit.
The existing MEMCACHED_E2BIG error code is used, which results in the error message "ITEM TOO BIG", such that no behavior change is intended in activation of the new validation pathways to the current client response when the server rejects the payload due to size.
https://github.com/memcached/memcached/wiki/ReleaseNotes142#configurable-maximum-item-size