lordgamez commented on a change in pull request #921:
URL: https://github.com/apache/nifi-minifi-cpp/pull/921#discussion_r504052806
##########
File path: extensions/civetweb/processors/ListenHTTP.h
##########
@@ -112,20 +115,22 @@ class ListenHTTP : public core::Processor {
}
}
+ std::size_t buffer_size_;
+ utils::ConcurrentQueue<FlowFileBufferPair> request_buffer;
Review comment:
I suppose it shouldn't be public as the consumer only should be allowed
to dequeue the buffer. Fixed it in
[0427909](https://github.com/apache/nifi-minifi-cpp/pull/921/commits/0427909155e707881d8640ca20e1c33b0c9d84f5)
##########
File path: extensions/civetweb/processors/ListenHTTP.cpp
##########
@@ -273,6 +325,34 @@ void ListenHTTP::Handler::set_header_attributes(const
mg_request_info *req_info,
}
}
+bool ListenHTTP::Handler::enqueueRequest(mg_connection *conn, const
mg_request_info *req_info, std::unique_ptr<io::BufferStream> content_buffer) {
+ auto flow_file = std::make_shared<FlowFileRecord>();
+ auto flow_version =
process_context_->getProcessorNode()->getFlowIdentifier();
+ if (flow_version != nullptr) {
+ flow_file->setAttribute(core::SpecialFlowAttribute::FLOW_ID,
flow_version->getFlowId());
+ }
+
+ if (!flow_file) {
+ sendHttp500(conn);
+ return true;
+ }
+
+ setHeaderAttributes(req_info, flow_file);
+
+ if (buffer_size_ == 0 || request_buffer.size() < buffer_size_) {
+ request_buffer.enqueue(std::make_pair(std::move(flow_file),
std::move(content_buffer)));
+ } else {
+ logger_->log_warn("ListenHTTP buffer is full");
Review comment:
Added the request method and uri to the log, I could not find anything
more specific to the message in the request info. It is already good to have
the information that the message was dropped. Fixed in
[0427909](https://github.com/apache/nifi-minifi-cpp/pull/921/commits/0427909155e707881d8640ca20e1c33b0c9d84f5)
##########
File path: extensions/civetweb/processors/ListenHTTP.cpp
##########
@@ -456,19 +473,28 @@ int64_t
ListenHTTP::WriteCallback::process(std::shared_ptr<io::BaseStream> strea
}
// Read a buffer of data from client
- rlen = mg_read(conn_, &buf[0], (size_t) rlen);
+ rlen = mg_read(conn, &buf[0], (size_t) rlen);
if (rlen <= 0) {
break;
}
// Transfer buffer data to the output stream
- stream->write(&buf[0], gsl::narrow<int>(rlen));
+ content_buffer->write(&buf[0], gsl::narrow<int>(rlen));
nlen += rlen;
}
- return nlen;
+ return content_buffer;
+}
+
+ListenHTTP::WriteCallback::WriteCallback(std::unique_ptr<io::BufferStream>
request_content)
+ : logger_(logging::LoggerFactory<ListenHTTP::WriteCallback>::getLogger())
Review comment:
Fixed in
[0427909](https://github.com/apache/nifi-minifi-cpp/pull/921/commits/0427909155e707881d8640ca20e1c33b0c9d84f5)
----------------------------------------------------------------
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]