lordgamez commented on code in PR #1321:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1321#discussion_r869048323
##########
extensions/http-curl/client/HTTPClient.cpp:
##########
@@ -455,6 +455,39 @@ void HTTPClient::setFollowRedirects(bool follow) {
curl_easy_setopt(http_session_, CURLOPT_FOLLOWLOCATION, follow);
}
+bool HTTPClient::isValidHTTPHeaderField(std::string_view field_name) {
+ if (field_name.size() == 0) {
+ 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;
+}
+
+std::string
HTTPClient::replaceInvalidCharactersInHTTPHeaderFieldName(std::string_view
field_name) {
+ if (field_name.size() == 0) {
+ return "";
+ }
Review Comment:
I agree, it seems that empty attribute name is accepted, but in this case we
should replace it to a valid name and "X-MiNiFi-Empty-Attribute-Name" sounds
good. Updated in 2d58393dbbb46ec17e56b961e01f04e1be6880bb
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]