lordgamez commented on code in PR #1354:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1354#discussion_r926469345


##########
extensions/http-curl/client/HTTPClient.cpp:
##########
@@ -437,29 +439,24 @@ void HTTPClient::setFollowRedirects(bool follow) {
 }
 
 bool HTTPClient::isValidHttpHeaderField(std::string_view field_name) {
-  if (field_name.size() == 0) {
+  if (field_name.empty()) {
     return false;
   }
 
   // RFC822 3.1.2: The  field-name must be composed of printable ASCII 
characters
   // (i.e., characters that  have  values  between  33.  and  126., decimal, 
except colon).
-  for (auto ch : field_name) {
-    if (ch < 33 || ch > 126 || ch == ':') {
-      return false;
-    }
-  }
-  return true;
+  return ranges::all_of(field_name, [](char c) { return c >= 33 && c <= 126 && 
c != ':'; });
 }
 
 std::string 
HTTPClient::replaceInvalidCharactersInHttpHeaderFieldName(std::string_view 
field_name) {
-  if (field_name.size() == 0) {
+  if (field_name.empty()) {
     return "X-MiNiFi-Empty-Attribute-Name";
   }
 
   std::string result;
   // RFC822 3.1.2: The  field-name must be composed of printable ASCII 
characters
   // (i.e., characters that  have  values  between  33.  and  126., decimal, 
except colon).
-  for (auto ch : field_name) {
+  for (auto ch : field_name) {  // NOLINT(readability-use-anyofallof)

Review Comment:
   Good idea, updated in d3b1db61b23d80b28385fde5f77af73c4661b95a



-- 
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: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to