zchuango commented on code in PR #3409:
URL: https://github.com/apache/brpc/pull/3409#discussion_r3735929883


##########
example/http_c++/http_client.cpp:
##########
@@ -36,6 +39,25 @@ namespace brpc {
 DECLARE_bool(http_verbose);
 }
 
+class PartDataReader: public brpc::ProgressiveReader {
+public:
+    explicit PartDataReader(bthread::CountdownEvent* done): _done(done){}
+
+    butil::Status OnReadOnePart(const void* data, size_t length) {
+        memcpy(_buffer, data, length);
+        LOG(INFO) << "data : " << _buffer << " size : " << length;
+        return butil::Status::OK();
+    }

Review Comment:
   Fixed. The example now constructs a length-aware std::string directly from 
each data part, avoiding the fixed-size buffer overflow and NUL-termination 
issues.



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to