[
https://issues.apache.org/jira/browse/DISPATCH-179?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15022239#comment-15022239
]
ASF GitHub Bot commented on DISPATCH-179:
-----------------------------------------
Github user ted-ross commented on a diff in the pull request:
https://github.com/apache/qpid-dispatch/pull/36#discussion_r45614085
--- Diff: src/router_core/management_agent.c ---
@@ -268,6 +269,62 @@ static void qd_core_agent_read_handler(qd_dispatch_t
*qd,
}
+/**
+ * Returns true if all the keys contained in the body map are applicable
to a waypoints, false otherwise
+ * @see qdr_waypoint_columns
+ */
+static bool qd_is_valid_waypoint_keys(qd_parsed_field_t *in_body)
+{
+ if(in_body != 0 && qd_parse_is_map(in_body)) {
+ //
+ // A map containing attributes with invalid values for an entity
MUST result in a failure response with a statusCode of 400 (Bad Request).
+ //
+ int j=0;
+ qd_parsed_field_t *field = qd_parse_sub_key(in_body, j);
+ while (field) {
+ bool found = false;
+ for(int i = 1; i < QDR_WAYPOINT_COLUMN_COUNT; i++) {
+ if (qd_field_iterator_equal(qd_parse_raw(field), (unsigned
char*)qdr_waypoint_columns[i])) {
+ found = true;
+ break;
+ }
+ }
+ if (!found) // Some bad field was specified in the body map.
Reject this request
+ return false;
+ j++;
+ field = qd_parse_sub_key(in_body, j);
+ }
+ }
+ else
+ // The body is either empty or the body is not a map, return false
+ return false;
+
+ return true;
+}
+
+
+/**
+ * The body map containing any attributes that are not applicable for the
entity being updated MUST result in a failure response with a statusCode of 400
(Bad Request).
+ */
+static bool qd_check_body(qd_router_entity_type_t entity_type,
--- End diff --
This function's signature suggests that it is simply checking the message
body. In fact, it also has the side effect of composing the error message for
the response. I think it would be better to stick with the simple check. The
calling logic will then be clearer to understand as it will either go forward
with the request or create an error response based on the outcome of this check.
> Refactor Router Core
> --------------------
>
> Key: DISPATCH-179
> URL: https://issues.apache.org/jira/browse/DISPATCH-179
> Project: Qpid Dispatch
> Issue Type: Improvement
> Components: Router Node
> Reporter: Ted Ross
> Assignee: Ted Ross
> Fix For: 0.6
>
>
> Refactor the core router function to clean up the architecture and to fix the
> significant lock contention issue that exists in 0.5.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]