Skip to content
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 headerValue to logs about bad header #2411

Merged
merged 4 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES_NEXT_RELEASE
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
- [cygnus-ngsi][restHandler] Add header value to logs about bad header (#2410)
- [cygnus-ngsi] Upgrade Debian version from 12.5 to 12.6 in Dockerfile
- [cygnus-common][cygnus-ngsi] New setting mongo_uri (#2387)
- [cygnus-common][cygnus-ngsi] Deprecate (mongo_hosts, mongo_username, mongo_password, mongo_auth_source, mongo_replica_set) (use mongo_uri instead)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,11 +213,11 @@ public List<Event> getEvents(javax.servlet.http.HttpServletRequest request) thro
LOGGER.warn("[NGSIRestHandler] Bad HTTP notification ('"
+ CommonConstants.HEADER_FIWARE_SERVICE
+ "' header length greater than "
+ NGSIConstants.SERVICE_HEADER_MAX_LEN + ")");
+ NGSIConstants.SERVICE_HEADER_MAX_LEN + ") for " + headerValue);
throw new HTTPBadRequestException(
"'" + CommonConstants.HEADER_FIWARE_SERVICE
+ "' header length greater than "
+ NGSIConstants.SERVICE_HEADER_MAX_LEN + ")");
+ NGSIConstants.SERVICE_HEADER_MAX_LEN + ") for " + headerValue);
} else {
service = headerValue;
} // if else
Expand All @@ -231,17 +231,17 @@ public List<Event> getEvents(javax.servlet.http.HttpServletRequest request) thro
LOGGER.warn("[NGSIRestHandler] Bad HTTP notification ('"
+ CommonConstants.HEADER_FIWARE_SERVICE_PATH
+ "' header value length greater than "
+ NGSIConstants.SERVICE_PATH_HEADER_MAX_LEN + ")");
+ NGSIConstants.SERVICE_PATH_HEADER_MAX_LEN + ") for " + headerValue);
throw new HTTPBadRequestException(
"'fiware-servicePath' header length greater than "
+ NGSIConstants.SERVICE_PATH_HEADER_MAX_LEN + ")");
+ NGSIConstants.SERVICE_PATH_HEADER_MAX_LEN + ") for " + headerValue);
} else if (wrongServicePathHeaderInitialCharacter(splitValue)) {
LOGGER.warn("[NGSIRestHandler] Bad HTTP notification ('"
+ CommonConstants.HEADER_FIWARE_SERVICE_PATH
+ "' header value must start with '/'");
+ "' header value " + headerValue + " must start with '/'");
throw new HTTPBadRequestException(
"'" + CommonConstants.HEADER_FIWARE_SERVICE_PATH
+ "' header value must start with '/'");
+ "' header value " + headerValue + " must start with '/'");
} // if else
} // for

Expand All @@ -252,7 +252,7 @@ public List<Event> getEvents(javax.servlet.http.HttpServletRequest request) thro
ngsiVersion = headerValue;
break;
default:
LOGGER.debug("[NGSIRestHandler] Unnecessary header");
LOGGER.debug("[NGSIRestHandler] Unnecessary header: " + headerName + " value " + headerValue);
} // switch
} // while

Expand Down
Loading