phrocker commented on a change in pull request #610: MINIFICPP-814 - Fixed 
ListenHTTP and HTTPClient bugs, created tests f…
URL: https://github.com/apache/nifi-minifi-cpp/pull/610#discussion_r304565538
 
 

 ##########
 File path: extensions/http-curl/client/HTTPClient.cpp
 ##########
 @@ -196,7 +255,7 @@ std::string HTTPClient::escape(std::string 
string_to_escape) {
 
 void HTTPClient::setPostFields(std::string input) {
   curl_easy_setopt(http_session_, CURLOPT_POSTFIELDSIZE, input.length());
-  curl_easy_setopt(http_session_, CURLOPT_POSTFIELDS, input.c_str());
+  curl_easy_setopt(http_session_, CURLOPT_COPYPOSTFIELDS, input.c_str());
 
 Review comment:
   If memory serves this was at the behest of a review comment to avoid the 
copies, but the string isn't a ref and any non const op to the initial string 
would change the ptr. 
   
   I don't want to give validity to the potential wastefulness of copies and 
hate the idea of saying "potential" without proof of profiling or examples of 
error  but if an HTTP Client is re-used could we create an internal copy of the 
string that is re-used? if I recall correctly we'd be re-copying the data on 
every submission correct? Is there the potential or ability to honor this 
initial request, correctly this time, without incurring copies? 
   
   It may be the case where re-use is now precluded....I haven't dug into that. 

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to