Skip to content

Commit

Permalink
Merge pull request #2411 from telefonicaid/task/add_header_value_logs…
Browse files Browse the repository at this point in the history
…_about_bad_header

add headerValue to logs about bad header
  • Loading branch information
fgalan authored Sep 19, 2024
2 parents 30ac63c + 9c549cb commit 8f553a8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
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

0 comments on commit 8f553a8

Please sign in to comment.