wasphin opened a new pull request, #3584:
URL: https://github.com/apache/brpc/pull/3584
### What problem does this PR solve?
Issue Number: N/A
Problem Summary:
The Consul naming service assumes that every response array entry and its
`Service` field are JSON objects before accessing their members. Responses
containing other JSON value types are not handled correctly.
### What is changed and the side effects?
Changed:
- Check both values with `IsObject()` before accessing object members and
skip invalid entries using the existing error-handling policy.
- Add HTTP client/server regression coverage for non-object values at both
boundaries, mixed valid and invalid entries, and stale result clearing.
The test server uses an automatically assigned port.
Side effects:
- Performance effects: adds two type checks per valid service entry.
- Breaking backward compatibility: none for valid Consul responses. Mixed
responses retain valid services; responses with only invalid entries are
rejected.
---
### Check List:
- Please make sure your changes are compilable.
- When providing us with a new feature, it is best to add related tests.
- Please follow [Contributor Covenant Code of
Conduct](https://github.com/apache/brpc/blob/master/CODE_OF_CONDUCT.md).
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]