Only allow one stdin record, avoid the copy

This commit is contained in:
flamingcow
2019-05-09 19:30:36 -07:00
parent 67f0fc48f9
commit 05382c76a5
3 changed files with 14 additions and 7 deletions

View File

@@ -124,8 +124,10 @@ int Connection::Read() {
callback_(&request_);
buf_.Consume(); // discard data and invalidate pointers
} else {
std::string_view in(buf_.Read(header->ContentLength()), header->ContentLength());
request_.AddIn(in);
if (!request_.GetBody().empty()) {
LOG(ERROR) << "received multiple stdin records. have you set \"fastcgi_request_buffering on\"?";
}
request_.SetBody({buf_.Read(header->ContentLength()), header->ContentLength()});
}
}
break;