-
Notifications
You must be signed in to change notification settings - Fork 154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add http-check and http-modify filters #48089
Conversation
5fc4533
to
d76c190
Compare
e14e36f
to
92f2a6d
Compare
92f2a6d
to
fd8885f
Compare
a7886f9
to
9a8e000
Compare
9a8e000
to
19f56ac
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have the context to fully understand what's going on here, but there was one bit that stood out as potentially odd. Hope that's helpful!
while(it.hasNext()) | ||
{ | ||
it.next(); | ||
vmap[it.key()] = it.value(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels like an odd construction. I don't have the context on exactly what you are doing here but it looks like you are skipping the first item in the iterator by calling it.next()
before copying. Is that intentional? I guess it must be, but maybe a comment as to what you are skipping might help make this look a little less odd! Same with the two loops that follow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The iterator requires calling next()
to access the first item, so the code is intentional and not skipping the first item. It's a quirk of Qt's unintuitive "Java-style" API:
Unlike STL-style iterators, Java-style iterators point between items rather than directly at items. The first call to next() advances the iterator to the position between the first and second item, and returns the first item; the second call to next() advances the iterator to the position between the second and third item; and so on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh! What an odd interface! Well, that makes sense - thanks for explaining it.
This adds two new message filters that allow delegating filtering logic to an HTTP server:
http-check
: Sends metadata only (no message content) to the server, to determine the action (send or drop).http-modify
: Sends metadata and message content to the server, to determine the action and potentially have the content modified.For both filters, the target endpoint is specified using the subscription metadata field
url
. Requests use thePOST
method and containSub-Meta
,Pub-Meta
, andGrip-Last
headers. For thehttp-modify
filter, the message content is included in the body (http-check
filter leaves the body empty). The server is expected to reply with a status code 200 or 204, and optionally anAction: drop
header to indicate a drop action. Forhttp-modify
, code 200 means the replacement content is in the response body, and code 204 means no change to the content.