cloudbase-ai opened a new issue, #7904:
URL: https://github.com/apache/shenyu/issues/7904
### Bug
On master `fda742c48e7f553c9964cf74b36732326d0fde00`, Request plugin
replacement rules can delete values when the source and destination identify
the same key.
- `parameter.replaceParameterKeys={"token":"token"}` changes
`/files/a%2Fb?token=first&token=second&keep=1` into `/files/a%2Fb?keep=1`.
- `header.replaceHeaderKeys={"X-Id":"X-Id"}` drops `X-Id` entirely.
- A case-only header replacement, such as `{"X-Id":"x-id"}`, also drops all
values because HttpHeaders treats those names as the same key.
An identity rename should retain values and query ordering; changing only a
header name's casing must retain its values.
### Evidence
Five new tests invoke the actual RequestPlugin.doExecute through its normal
cached rule handle. Both identity query cases fail, including mixed
valueless/empty/repeated values. Three exact/case-only header cases fail with a
missing header. The existing request tests remain passing.
### Cause and repair
`replaceParameterKey` and `replaceHeaderKey` append the source values to the
destination and then remove the source. For an identity key (or case-equivalent
HTTP header), the final remove deletes the same entry that was just updated.
Skip exact identity replacements to retain parameter order. For a header
that is being renamed, remove the source before appending its values to the
destination; this also handles case-only renames safely. Preserve the current
destination-first merging order for distinct keys, case-sensitive query-key
semantics, multi-values, missing-source behavior, and encoded paths. Cookie
replacement already uses remove-before-add and does not need changing.
I am preparing a focused fix with ordinary-rename controls and a real HTTP
forwarding comparison. No new dependencies or changes to rule schema are needed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]